Part Number Hot Search : 
SUF103 MC10E131 1610B CHR2297 B1500 C7020 0R12M EF20C01
Product Description
Full Text Search
 

To Download MC68HC11KW1 Datasheet File

  If you can't view the Datasheet, Please click here to try to view without PDF Reader .  
 
 


  Datasheet File OCR Text:
  hc11 MC68HC11KW1/d MC68HC11KW1 technical data !motorola MC68HC11KW1 !motorola technical data

all products are sold on motorola? terms & conditions of supply. in ordering a product covered by this document the customer agrees to be bound by those terms & conditions and nothing contained in this document constitutes or forms part of a contract (with the exception of the contents of this notice). a copy of motorola? terms & conditions of supply is availab le on request. motorola reserves the right to make changes without further notice to any products herein. motorola makes no warranty, representation or guarantee regarding the suitability of its products for any particular purpose, nor does motorola assume any liability arising out of the application or use of any product or circuit, and specifically disclaims any and all liability, in cluding without limitation consequential or incidental damages. ?ypical?parameters can and do vary in different applications. all operating parameters, including ?ypicals? must be validated for each customer application by customer? technical experts. motorola does not convey any license under its patent rights nor the rights of others. motorola products are not designed, intended, or authorized for use as components in systems intended for surgical implant into the body, or other applications intended to support or sustain life, or for any other application in which the failure of the motorola product could create a situation where personal injury or death may occur. should buyer purchase or use motorola products for any such unintended or unauthorized application, buyer shall indemnify and hold motorola and its officers, employees, subsidiaries, affiliates, and distributors harmless against all claims, costs, damages, and expenses, and reasonable attorney fees arising out of, directly or indirectly, any claim of personal injury or death associated with such unintended or unauthorized use, even if such claim alleges that motorola was negligent regarding the design or manufacture of the part. motorola and ! are registered trademarks of motorola, inc. motorola, inc. is an equal opportunity/affirmative action employer. the customer should ensure that it has the most up to date version of the document by contacting its local motorola office. this document supersedes any earlier documentation relating to the products referred to herein. the information contained in this document is current at the date of publication. it may subsequently be updated, revised or withdrawn. motorola ltd., 1999 all trade marks recognized. this document contains information on new products. speci?ations and information herein are subject to change without notice. MC68HC11KW1 high-density complementary metal oxide semiconductor (hcmos) microcontroller unit tpg 1
tpg 2 conventions where abbreviations are used in the text, an explanation can be found in the glossary, at the back of this manual. register and bit mnemonics are de?ed in the paragraphs describing them. an overbar is used to designate an active-low signal, eg: reset . because the bits in any one register are not necessarily linked by a common function, the description of a register may appear in several sections referring to different aspects of device operation. a full description of a bit is given only in a section in which it has relevance. elsewhere, it appears shaded in the register diagram and is only brie? described. when the state of a bit on reset is described as ?? this means that its state depends on factors such as the operating mode selected. a ? indicates that the bits state on reset is unde?ed.
MC68HC11KW1 motorola i table of contents paragraph number page number title table of contents 1 introduction 1.1 features.................................................................................................................1-1 1.2 mask option ...........................................................................................................1-2 2 pin descriptions 2.1 reset...................................................................................................................2-2 2.2 crystal driver and external clock input (xtal, extal)..........................................2-3 2.3 vdd and vss ........................................................................................................2-4 2.4 e clock output (e) ..................................................................................................2-4 2.5 xout.....................................................................................................................2-4 2.6 interrupt request (irq ) ..........................................................................................2-4 2.7 nonmaskable interrupt (xirq ) ..............................................................................2-5 2.8 moda and modb (moda/lir and modb/vstby) .............................................2-5 2.9 vrh and vrl ........................................................................................................2-6 2.10 r/w........................................................................................................................ 2-6 2.11 port signals ............................................................................................................2-6 2.11.1 port a ...............................................................................................................2-6 2.11.2 port b ...............................................................................................................2-8 2.11.3 port c ...............................................................................................................2-8 2.11.4 port d ...............................................................................................................2-8 2.11.5 port e ...............................................................................................................2-9 2.11.6 port f ...............................................................................................................2-9 2.11.7 port g...............................................................................................................2-9 2.11.8 port h ...............................................................................................................2-10 2.11.9 port j................................................................................................................2-1 0 2.11.10 port k ...............................................................................................................2-1 0 tpg 3
motorola ii MC68HC11KW1 table of contents paragraph number page number title 3 central processing unit 3.1 registers ...............................................................................................................3-1 3.1.1 accumulators a, b and d.................................................................................3-2 3.1.2 index register x (ix) .........................................................................................3-2 3.1.3 index register y (iy) .........................................................................................3-2 3.1.4 stack pointer (sp)............................................................................................3-2 3.1.5 program counter (pc)......................................................................................3-4 3.1.6 condition code register (ccr).........................................................................3-4 3.1.6.1 carry/borrow (c) ........................................................................................3-5 3.1.6.2 over?w (v) ...............................................................................................3-5 3.1.6.3 zero (z) ......................................................................................................3-5 3.1.6.4 negative (n) ...............................................................................................3-5 3.1.6.5 interrupt mask (i)........................................................................................3-5 3.1.6.6 half carry (h)..............................................................................................3-6 3.1.6.7 x interrupt mask (x) ...................................................................................3-6 3.1.6.8 stop disable (s)..........................................................................................3-6 3.2 data types .............................................................................................................3-6 3.3 opcodes and operands .........................................................................................3-7 3.4 addressing modes.................................................................................................3-7 3.5 immediate (imm) ...................................................................................................3-7 3.5.1 direct (dir)......................................................................................................3-7 3.5.2 extended (ext) ...............................................................................................3-8 3.5.3 indexed (ind, x; ind, y)...................................................................................3-8 3.5.4 inherent (inh) ..................................................................................................3-8 3.5.5 relative (rel)..................................................................................................3-8 3.6 instruction set ........................................................................................................3-8 4 operating modes and on-chip memory 4.1 operating modes ...................................................................................................4-1 4.1.1 single chip operating mode .............................................................................4-1 4.1.2 expanded operating mode...............................................................................4-1 4.1.3 special test mode ............................................................................................4-2 4.1.4 special bootstrap mode ...................................................................................4-2 4.2 on-chip memory....................................................................................................4-3 4.2.1 mapping allocations .........................................................................................4-3 4.2.1.1 ram ...........................................................................................................4-4 4.2.1.2 bootloader rom ........................................................................................4-4 4.2.2 registers..........................................................................................................4-4 4.3 system initialization ...............................................................................................4-10 4.3.1 mode selection.................................................................................................4-10 4.3.1.1 hprio ?highest priority i-bit interrupt & misc. register ...........................4-11 tpg 4
MC68HC11KW1 motorola iii table of contents paragraph number page number title 4.3.2 initialization ......................................................................................................4-12 4.3.2.1 config ?system con?uration register .................................................4-12 4.3.2.2 init ?ram and i/o mapping register ......................................................4-13 4.3.2.3 init2 ?eeprom mapping register..........................................................4-15 4.3.2.4 option ?system con?uration options register 1..................................4-15 4.3.2.5 opt2 ?system con?uration options register 2 ......................................4-17 4.3.2.6 bprot ?block protect register................................................................4-18 4.3.2.7 tmsk2 ?timer interrupt mask register 2 .................................................4-20 4.3.2.8 tctl4 and tctl6 ?timer 2 and 3 control registers ...............................4-21 4.4 memory expansion ................................................................................................4-22 4.4.1 memory expansion logic ..................................................................................4-22 4.4.2 extended addressing .......................................................................................4-23 4.4.3 memory expansion examples ..........................................................................4-24 4.4.4 mmsiz ?memory mapping window size register...........................................4-29 4.4.5 mmwbr ?memory mapping window base register ........................................4-30 4.4.6 mm1cr, mm2cr ?memory mapping window 1 and 2 control registers ........4-31 4.4.7 pgar ?port g assignment register ..............................................................4-32 4.5 chip selects ...........................................................................................................4-32 4.5.1 chip select priorities.........................................................................................4-33 4.5.2 program chip select .........................................................................................4-33 4.5.3 i/o chip select ..................................................................................................4-33 4.5.4 csctl ?chip select control register .............................................................4-34 4.5.5 general-purpose chip selects ..........................................................................4-35 4.5.5.1 gpcs1a ?general-purpose chip select 1 address register ....................4-35 4.5.5.2 gpcs1c ?general-purpose chip select 1 control register ......................4-36 4.5.5.3 gpcs2a ?general-purpose chip select 2 address register ....................4-37 4.5.5.4 gpcs2c ?general-purpose chip select 2 control register ......................4-37 4.5.6 one chip select driving another .......................................................................4-38 4.5.7 clock stretching ...............................................................................................4-39 4.5.7.1 cscstr ?chip select clock stretch register ...........................................4-39 4.6 eeprom and config register ............................................................................4-41 4.6.1 eeprom .........................................................................................................4-41 4.6.1.1 pprog ?eeprom programming control register ..................................4-41 4.6.1.2 eeprom bulk erase ..................................................................................4-43 4.6.1.3 eeprom row erase ...................................................................................4-43 4.6.1.4 eeprom byte erase ..................................................................................4-44 4.6.2 config register programming ........................................................................4-44 4.6.3 ram and eeprom security ............................................................................4-45 5 resets and interrupts 5.1 resets ...................................................................................................................5-1 5.1.1 power-on reset .................................................................................................5-1 5.1.2 external reset (reset ) ...................................................................................5-2 tpg 5
motorola iv MC68HC11KW1 table of contents paragraph number page number title 5.1.3 cop reset ........................................................................................................5-2 5.1.3.1 coprst ?arm/reset cop timer circuitry register...................................5-3 5.1.4 clock monitor reset ..........................................................................................5-3 5.1.5 option ?system con?uration options register 1 .......................................5-4 5.1.6 config ?con?uration control register .......................................................5-5 5.2 effects of reset.......................................................................................................5-6 5.2.1 central processing unit ....................................................................................5-7 5.2.2 memory map....................................................................................................5-7 5.2.3 parallel i/o .......................................................................................................5-7 5.2.4 timer 1.............................................................................................................5-7 5.2.5 timers 2 and 3.................................................................................................5-8 5.2.6 real-time interrupt (rti) ..................................................................................5-8 5.2.7 pulse accumulator ...........................................................................................5-8 5.2.8 computer operating properly (cop)................................................................5-8 5.2.9 serial communications interface (sci).............................................................5-8 5.2.10 serial peripheral interface (spi).......................................................................5-9 5.2.11 analog-to-digital converter...............................................................................5-9 5.2.12 system.............................................................................................................5-9 5.3 reset and interrupt priority ....................................................................................5-9 5.3.1 hprio ?highest priority i-bit interrupt and misc. register .............................5-10 5.4 interrupts ...............................................................................................................5-1 3 5.4.1 interrupt recognition and register stacking.......................................................5-13 5.4.2 nonmaskable interrupt request (xirq ) ...........................................................5-14 5.4.3 illegal opcode trap ...........................................................................................5-14 5.4.4 software interrupt ............................................................................................5-14 5.4.5 maskable interrupts .........................................................................................5-15 5.4.6 reset and interrupt processing........................................................................5-15 5.5 low power operation .............................................................................................5-15 5.5.1 wait ................................................................................................................5-15 5.5.2 stop ...............................................................................................................5-16 6 parallel input/output 6.1 port a.....................................................................................................................6 -2 6.1.1 porta ?port a data register ........................................................................6-2 6.1.2 ddra ?data direction register for port a ......................................................6-2 6.2 port b.....................................................................................................................6 -3 6.2.1 portb ?port b data register ........................................................................6-3 6.2.2 ddrb ?data direction register for port b ......................................................6-3 6.3 port c ....................................................................................................................6- 4 6.3.1 portc ?port c data register........................................................................6-4 6.3.2 ddrc ?data direction register for port c......................................................6-4 6.4 port d ....................................................................................................................6- 5 6.4.1 portd ?port d data register........................................................................6-5 tpg 6
MC68HC11KW1 motorola v table of contents paragraph number page number title 6.4.2 ddrd ?data direction register for port d......................................................6-5 6.5 port e.....................................................................................................................6 -6 6.5.1 porte ?port e data register ........................................................................6-6 6.6 port f .....................................................................................................................6 -7 6.6.1 portf ?port f data register.........................................................................6-7 6.6.2 ddrf ?data direction register for port f.......................................................6-7 6.7 port g ....................................................................................................................6- 8 6.7.1 portg ?port g data register .......................................................................6-8 6.7.2 ddrg ?data direction register for port g .....................................................6-9 6.7.3 pgar ?port g assignment register ..............................................................6-9 6.8 port h.....................................................................................................................6 -10 6.8.1 porth ?port h data register........................................................................6-10 6.8.2 ddrh ?data direction register for port h......................................................6-10 6.9 port j .....................................................................................................................6 -11 6.9.1 portj ?port j data register .........................................................................6-11 6.9.2 ddrj ?data direction register for port j .......................................................6-11 6.10 port k..................................................................................................................... 6-12 6.10.1 portk ?port k data register ........................................................................6-12 6.10.2 ddrk ?data direction register for port k ......................................................6-12 6.11 internal pull-up resistors ........................................................................................6-13 6.11.1 ppar ?port pull-up assignment register .......................................................6-13 6.12 system con?uration .............................................................................................6-14 6.12.1 opt2 ?system con?uration options register 2 ............................................6-14 6.12.2 config ?system con?uration register .......................................................6-15 7 serial communications interface 7.1 data format ............................................................................................................7-2 7.2 transmit operation .................................................................................................7-2 7.3 receive operation..................................................................................................7-2 7.4 wake-up feature ....................................................................................................7-4 7.4.1 idle-line wake-up ..............................................................................................7-4 7.4.2 address-mark wake-up ....................................................................................7-4 7.5 sci error detection ................................................................................................7-5 7.6 sci registers ..........................................................................................................7-5 7.6.1 scbdh, scbdl ?sci baud rate control registers ........................................7-6 7.6.2 sccr1 ?sci control register 1 .....................................................................7-7 7.6.3 sccr2 ?sci control register 2 .....................................................................7-9 7.6.4 scsr1 ?sci status register 1.......................................................................7-10 7.6.5 scsr2 ?sci status register 2.......................................................................7-11 7.6.6 scdrh, scdrl ?sci data high/low registers .............................................7-12 7.7 status ?gs and interrupts.....................................................................................7-12 7.7.1 receiver ?gs ..................................................................................................7-13 tpg 7
motorola vi MC68HC11KW1 table of contents paragraph number page number title 8 serial peripheral interface 8.1 functional description ...........................................................................................8-1 8.2 spi transfer formats...............................................................................................8-2 8.2.1 clock phase and polarity controls....................................................................8-3 8.3 spi signals ............................................................................................................8-3 8.3.1 master in slave out...........................................................................................8-4 8.3.2 master out slave in...........................................................................................8-4 8.3.3 serial clock ......................................................................................................8-4 8.3.4 slave select......................................................................................................8-4 8.4 spi system errors ..................................................................................................8-5 8.5 spi registers ..........................................................................................................8-5 8.5.1 spcr ?spi control register...........................................................................8-6 8.5.2 spsr ?spi status register ............................................................................8-8 8.5.3 spdr ?spi data register ..............................................................................8-9 8.5.4 opt2 ?system con?uration options register 2............................................8-9 9 timing system 9.1 timer 1 ..................................................................................................................9-1 9.1.1 timer 1 structure..............................................................................................9-3 9.1.2 input capture....................................................................................................9-4 9.1.2.1 tctl2 ?timer control register 2..............................................................9-6 9.1.2.2 tic1?ic3 ?timer input capture registers ..............................................9-7 9.1.2.3 ti4/o5 ?timer input capture 4/output compare 5 register.......................9-7 9.1.3 output compare ...............................................................................................9-8 9.1.3.1 toc1?oc4 ?timer output compare registers.......................................9-9 9.1.3.2 cforc ?timer compare force register ...................................................9-9 9.1.3.3 oc1m ?output compare 1 mask register................................................9-10 9.1.3.4 oc1d ?output compare 1 data register..................................................9-10 9.1.3.5 tcnt ?timer counter register .................................................................9-11 9.1.3.6 tctl1 ?timer control register 1..............................................................9-11 9.1.3.7 tmsk1 ?timer interrupt mask register 1.................................................9-12 9.1.3.8 tflg1 ?timer interrupt ?g register 1 ....................................................9-13 9.1.3.9 tmsk2 ?timer interrupt mask register 2.................................................9-14 9.1.3.10 tflg2 ?timer interrupt ?g register 2 ....................................................9-15 9.2 timer 2 ..................................................................................................................9-1 5 9.2.1 output compare ...............................................................................................9-18 9.2.2 input capture....................................................................................................9-18 9.2.3 f23frc ?compare force register for timers 2 and 3. ..................................9-18 9.2.4 t2c4 ?timer 2 channel 4 register.................................................................9-19 9.2.5 t2oc1?2oc3 ?timer 2 output compare registers .....................................9-19 9.2.6 tcnt2 ?timer 2 counter register..................................................................9-20 tpg 8
MC68HC11KW1 motorola vii table of contents paragraph number page number title 9.2.7 tctl3 ?timer control register 3 (timer 2) ....................................................9-20 9.2.8 tctl4 ?timer control register 4 (timer 2) ....................................................9-21 9.2.9 t2msk ?timer 2 interrupt mask register.......................................................9-22 9.2.10 t2flg ?timer 2 interrupt ?g register ..........................................................9-23 9.3 timer 3 ..................................................................................................................9-2 4 9.3.1 t3c4 ?timer 3 channel 4 register .................................................................9-24 9.3.2 t3oc1?3oc3 ?timer 3 output compare registers .....................................9-26 9.3.3 tcnt3 ?timer 3 counter register..................................................................9-26 9.3.4 tctl5 ?timer control register 5 (timer 3) ....................................................9-27 9.3.5 tctl6 ?timer control register 6 (timer 3) ....................................................9-27 9.3.6 t3msk ?timer 3 interrupt mask register.......................................................9-29 9.3.7 t3flg ?timer 3 interrupt ?g register ..........................................................9-30 9.4 real-time interrupt .................................................................................................9-31 9.4.1 tmsk2 ?timer interrupt mask register 2.......................................................9-31 9.4.2 tflg2 ?timer interrupt ?g register 2 ..........................................................9-32 9.4.3 pactl ?pulse accumulator control register ..................................................9-33 9.5 computer operating properly watchdog function ...................................................9-33 9.6 pulse accumulator .................................................................................................9-33 9.6.1 pactl ?pulse accumulator control register ..................................................9-35 9.6.2 pacnt ?pulse accumulator count register ...................................................9-36 9.6.3 pulse accumulator status and interrupt bits .....................................................9-36 9.6.3.1 tmsk2 ?timer interrupt mask 2 register .................................................9-36 9.6.3.2 tflg2 ?timer interrupt ?g 2 register ....................................................9-36 9.7 pulse-width modulation (pwm) timer ....................................................................9-37 9.7.1 pwm timer block diagram ................................................................................9-38 9.7.2 pwclk ?pwm clock prescaler and 16-bit select register.............................9-38 9.7.2.1 16-bit pwm function ...................................................................................9-38 9.7.2.2 clock prescaler selection ...........................................................................9-40 9.7.3 pwpol ?pwm timer polarity & clock source select register ........................9-41 9.7.4 pwscal ?pwm timer prescaler register......................................................9-41 9.7.5 pwen ?pwm timer enable register ..............................................................9-42 9.7.6 pwcnt1? ?pwm timer counter registers 1 to 4.........................................9-43 9.7.7 pwper1? ?pwm timer period registers 1 to 4...........................................9-43 9.7.8 pwdty1? ?pwm timer duty cycle registers 1 to 4.....................................9-44 9.7.9 boundary cases ...............................................................................................9-44 10 analog-to-digital converter 10.1 conversion process .............................................................................................10-2 10.2 channel assignments ..........................................................................................10-2 10.3 single channel operation .....................................................................................10-3 10.3.1 4-conversion, single scan...............................................................................10-4 10.3.2 4-conversion, continuous scan.......................................................................10-4 10.3.3 8-conversion, single scan...............................................................................10-4 tpg 9
motorola viii MC68HC11KW1 table of contents paragraph number page number title 10.3.4 8-conversion, continuous scan ......................................................................10-4 10.4 multiple channel operation...................................................................................10-4 10.4.1 4-channel single scan ....................................................................................10-5 10.4.2 4-channel continuous scan ............................................................................10-5 10.4.3 8-channel single scan ....................................................................................10-5 10.4.4 8-channel continuous scan ............................................................................10-5 10.5 power-up and clock select...................................................................................10-5 10.6 operation in stop and wait modes..................................................................10-6 10.7 registers .............................................................................................................10-6 10.7.1 adctl ?a/d control and status register .....................................................10-6 10.7.2 adfrq ?a/d converter frequency select register ......................................10-7 10.7.3 adr1 ?adr8 a/d result registers ..............................................................10-8 a electrical specifications a.1 maximum ratings .................................................................................................. a-1 a.2 thermal characteristics and power considerations .............................................. a-2 a.3 test methods ........................................................................................................ a-3 a.4 dc electrical characteristics ................................................................................. a-4 a.5 control timing ....................................................................................................... a-5 a.5.1 peripheral port timing...................................................................................... a-8 a.5.2 analog-to-digital converter characteristics...................................................... a-10 a.5.3 serial peripheral interface timing .................................................................... a-11 a.5.4 non-multiplexed expansion bus timing ........................................................... a-14 a.6 eeprom characteristics ...................................................................................... a-15 b mechanical data b.1 packaging ............................................................................................................. b-1 c development systems c.1 evs ?evaluation system.................................................................................... c-1 c.2 mmds11 ?motorola modular development system ........................................... c-2 c.3 spgmr11 ?serial peripheral system ................................................................ c-2 tpg 10
MC68HC11KW1 motorola xi list of figures figure number page number title list of figures 1-1 MC68HC11KW1 block diagram..............................................................................1-3 2-1 MC68HC11KW1 100-pin tqfp..............................................................................2-1 2-2 external reset circuitry............................................................................................2-2 2-3 oscillator connections ............................................................................................2-3 2-4 ram stand-by connections.....................................................................................2-5 3-1 programming model ...............................................................................................3-1 3-2 stacking operations ................................................................................................3-3 4-1 MC68HC11KW1 memory map ...............................................................................4-3 4-2 ram and register overlap.......................................................................................4-14 4-3 memory map example of memory expansion.........................................................4-25 4-4 schematic example of memory expansion .............................................................4-26 4-5 memory map example of memory expansion.........................................................4-27 4-6 schematic example of memory expansion .............................................................4-28 5-1 processing ?w out of reset (1 of 2) .......................................................................5-17 5-2 processing ?w out of reset (2 of 2) .......................................................................5-18 5-3 interrupt priority resolution (1 of 3) .........................................................................5-19 5-4 interrupt priority resolution (2 of 3) .........................................................................5-20 5-5 interrupt priority resolution (3 of 3) .........................................................................5-21 5-6 interrupt source resolution within the sci subsystem ............................................5-22 7-1 sci baud rate generator circuit diagram.................................................................7-1 7-2 sci block diagram ..................................................................................................7-3 7-3 interrupt source resolution within sci.....................................................................7-14 8-1 spi block diagram...................................................................................................8-2 8-2 spi transfer format..................................................................................................8-3 9-1 timer clock divider chains ......................................................................................9-2 9-2 timer 1 capture/compare block diagram ................................................................9-5 9-3 timer 2 capture/compare block diagram ................................................................9-17 9-4 timer 3 capture/compare block diagram ................................................................9-25 9-5 pulse accumulator block diagram...........................................................................9-34 9-6 pwm timer block diagram.......................................................................................9-39 9-7 pwm duty cycle......................................................................................................9-44 a-1 test methods ......................................................................................................... a-3 a-2 timer inputs........................................................................................................... a-5 tpg 11
motorola xii MC68HC11KW1 list of figures figure number page number title a-3 reset timing ...........................................................................................................a-6 a-4 interrupt timing .......................................................................................................a-6 a-5 stop recovery timing ............................................................................................a-7 a-6 wait recovery timing .............................................................................................a-7 a-7 port read timing diagram ........................................................................................a-8 a-8 port g control timing...............................................................................................a-8 a-9 port write timing diagram........................................................................................a-9 a-10 spi master timing (cpha = 0) ...............................................................................a-12 a-11 spi master timing (cpha = 1) ...............................................................................a-12 a-12 spi slave timing (cpha = 0) ..................................................................................a-13 a-13 spi slave timing (cpha = 1) ..................................................................................a-13 a-14 expansion bus timing .............................................................................................a-15 b-1 100-pin tqfp .........................................................................................................b-1 b-2 100-pin tqfp mechanical dimensions...................................................................b-2 tpg 12
MC68HC11KW1 motorola xiii list of tables ta b l e number page number title list of tables 2-1 port signal functions ...............................................................................................2-7 3-1 reset vector comparison........................................................................................3-4 3-2 instruction set .........................................................................................................3-9 4-1 example bootloader baud rates..............................................................................4-2 4-2 register and control bit assignments .....................................................................4-5 4-3 registers with limited write access.........................................................................4-10 4-4 hardware mode select summary............................................................................4-11 4-5 ram and register remapping..................................................................................4-14 4-6 eeprom remapping ..............................................................................................4-15 4-7 xclk frequencies...................................................................................................4-18 4-8 eeprom block protect...........................................................................................4-19 4-9 cpu address and address expansion signals ........................................................4-24 4-10 window size select .................................................................................................4-29 4-11 memory expansion window base address..............................................................4-30 4-12 chip select priorities ...............................................................................................4-33 4-13 program chip select size ........................................................................................4-34 4-14 general purpose chip select priority.......................................................................4-35 4-15 general-purpose chip select 1 size control ............................................................4-37 4-16 general-purpose chip select 2 size control ............................................................4-38 4-17 one chip select driving another ..............................................................................4-39 4-18 chip select control parameter summary.................................................................4-40 4-19 erase mode selection .............................................................................................4-42 5-1 cop timer rate select .............................................................................................5-2 5-2 reset cause, reset vector and operating mode ......................................................5-6 5-3 highest priority interrupt selection ..........................................................................5-11 5-4 interrupt and reset vector assignments ..................................................................5-12 5-5 stacking order on entry to interrupts ......................................................................5-13 6-1 port con?uration ...................................................................................................6-1 7-1 example sci baud rate control values ...................................................................7-7 8-1 spi clock rates........................................................................................................8-7 9-1 timer 1 resolution and capacity..............................................................................9-3 9-2 rti periodic rates ...................................................................................................9-31 9-3 pulse accumulator timing .......................................................................................9-34 tpg 13
motorola xiv MC68HC11KW1 list of tables ta b l e number page number title 9-4 clock a and clock b prescalers .............................................................................. 9-40 10-1 channel assignments........................................................................................... 10-3 c-1 m68hc11 development tools ................................................................................ c-1 tpg 14
MC68HC11KW1 motorola 1-1 introduction 1 1 introduction the MC68HC11KW1 8-bit microcontroller is a member of the m68hc11 family of hcmos microcontrollers. it has 640 bytes of eeprom and 768 bytes of ram. making use of a 100-pin tqfp package, a non-multiplexed expanded bus is a feature of this device. the main timer system includes three input captures, four output compares and a software selectable input capture or output compare. there are two additional 16-bit timers, each with three output compares and one software selectable input capture or output compare. other major features of this device are: a 10-channel, 10-bit resolution a/d converter, four pwm timer channels, an spi (serial peripheral interface) and an enhanced sci (serial communications interface). in common with other family members, the MC68HC11KW1 also includes an 8-bit pulse accumulator circuit, a real time interrupt facility, and a computer operating properly watchdog system. this device is intended for use in expanded memory applications. 1.1 features low power, high performance m68hc11 cpu core with 4mhz internal bus frequency 768 bytes of ram 640 bytes of byte-erasable eeprom, with on-chip charge pump 448 bytes of boot rom up to 70 general purpose i/o lines, plus up to 10 input-only lines non-multiplexed address and data buses, permitting direct access to the full 64k byte address map memory expansion unit, with six address extension lines, allowing up to (for example) sixteen 32k byte banks of external memory to be addressed in either of two bank windows four external chip selects 16-bit timer with 3/4 input captures and 5/4 output compares; pulse accumulator and cop watchdog timer real-time interrupt circuit tpg 15
motorola 1-2 MC68HC11KW1 introduction 1 two additional 16-bit timers, each with 3 output compares and one input capture or output compare (may be externally clocked, if required, for external event counter operation) sci subsystem (nrz type for compatibility with standard rs232 systems) with parity and a modulus prescaler spi subsystem, with software selectable msb/lsb ?st option and increased baud rate selection range 10-channel, 10-bit analog-to-digital converter four 8-bit pwm timer channels available in 100-pin tqfp package 1.2 mask option there is a single mask option on the MC68HC11KW1, which is programmed during manufacture and must be speci?d on the order form: security option (available/unavailable). see section 4.6.3 tpg 16
MC68HC11KW1 motorola 1-3 introduction 1 figure 1-1 MC68HC11KW1 block diagram pa7 pa6 pa5 pa4 pa2 pa1 pa0 pa3 pd7 pd6 pd5 pd4 pd2 pd1 pd0 pd3 pe0 pe1 pe2 pe3 pe5 pe6 pe7 pe4 pg7 pg6 pg5 pg4 pg2 pg1 pg0 pg3 ph7 ph6 ph5 ph4 ph2 ph1 ph0 ph3 oc1/pai oc1/oc2 oc1/oc3 oc1/oc4 ic4/oc1/oc5 ic1 ic2 ic3 timer 1 cop w atchdog periodic interrupt pulse accum ulator port a port d port e port g port h ss sck mosi miso spi+ sci+ txd rxd vrh vrl an9 an8 an7 an6 an5 an4 an3 an2 an1 an0 10-channel, a/d converter memory expansion xa18 xa17 xa16 xa15 xa14 xa13 chip selects pwm cspr og csgp2 csgp1 csio pw4 pw3 pw2 pw1 non-m ultiplexed address and data buses port b port f port c addr15 addr14 addr13 addr12 addr11 addr0 addr9 addr8 addr7 addr6 addr5 addr4 addr3 addr2 addr1 addr0 data7 data6 data5 data4 data3 data2 data1 data0 pb7 pb6 pb5 pb4 pb3 pb2 pb1 pb0 pf7 pf6 pf5 pf4 pf3 pf2 pf1 pf0 pc7 pc6 pc5 pc4 pc3 pc2 pc1 pc0 pj7 pj6 pj5 pj4 pj2 pj1 pj0 pj3 oc4/ic1 oc3 oc2 oc1 ecin timer 2 pk7 pk6 pk5 pk4 pk2 pk1 pk0 pk3 oc4/ic1 oc3 oc2 oc1 ecin timer 3 xirq irq reset lir /moda vstby/modb interr upts & mode select vdd vss 3 3 640 bytes eeprom 768 bytes ram m68hc11 cpu port j port k oscillator xtal extal r/w e xout vddad vssad 10-bit tpg 17
motorola 1-4 MC68HC11KW1 introduction 1 this page left blank intentionally tpg 18
MC68HC11KW1 motorola 2-1 pin descriptions 2 2 pin descriptions the MC68HC11KW1 is available packaged in a 100-pin thin quad ?t pack (tqfp), as shown in figure 2-1. most pins on this mcu serve two or more functions, as described in the following paragraphs. figure 2-1 MC68HC11KW1 100-pin tqfp 75 74 72 71 70 69 68 67 66 65 64 63 62 61 60 73 pd3/mosi pd2/miso pd0/rxd pd1/txd 1 2 4 5 6 7 8 9 10 11 12 13 14 15 16 3 59 58 57 56 55 54 53 52 51 18 20 19 17 21 22 23 24 25 moda/lir modb/vstby reset xtal extal xout e vdd vss pc7/data7 pc6/data6 pc5/data5 pc4/data4 pc3/data3 pc2/data2 pc1/data1 pc0/data0 irq pf0/addr0 pf1/addr1 pf2/addr2 pk4/oc1 pk3/ecin pk2 pk1 pk0 ph0/pwm1 ph1/pwm2 ph2/pwm3 ph3/pwm4 ph4/csio ph5/csgp1 ph6/csgp2 ph7/ cspr og r/w xirq vdd vss pg0/xa13 pg1/xa14 pg2/xa15 pg3/xa16 pg4/xa17 pg5/xa18 pg6/an0 pg7/an1 100 99 97 96 95 94 93 92 91 90 89 88 87 86 85 98 pk5/oc2 pk6/oc3 pb0/addr8 pk7/c4 84 83 82 81 80 79 78 77 76 pb1/addr9 pb2/addr10 pb3/addr11 pb4/addr12 pb5/addr13 pb6/addr14 pb7/addr15 vdd vss pa0/ic3/oc1 pa1/ic2/oc1 pa2/ic1/oc1 pa3/ic4/oc5/oc1 pa4/oc4/oc1 pa5/oc3/oc1 pa6/oc2/oc1 pa7/pai/oc1 pd7 pd6 pd5/ss pd4/sck 26 27 29 30 31 32 33 34 35 36 37 38 39 40 41 28 43 45 44 42 46 47 48 49 50 vrh vrl vddad pe7/an9 pe6/an8 pe5/an7 pe4/an6 pe3/an5 pe2/an4 pe1/an3 pe0/an2 vssad pj0 pj1 pj2 pj3/ecin pj4/oc1 pj5/oc2 pj6/oc3 pj7/c4 pf7/addr7 pf6/addr6 pf5/addr5 pf4/addr4 pf3/addr3 tpg 19
motorola 2-2 MC68HC11KW1 pin descriptions 2 2.1 reset an active-low, bidirectional control signal, reset acts as an input to initialize the mcu to a known start-up state. it also acts as an open-drain output to indicate that an internal failure has been detected in either the clock monitor or the cop watchdog circuit. the cpu distinguishes between internal and external reset conditions by sensing whether the reset pin rises to a logic one in less than four e clock cycles after an internal reset has been released. it is therefore not advisable to connect an external resistor-capacitor (rc) power-up delay circuit to the reset pin of m68hc11 devices because the circuit charge time constant can cause the device to misinterpret the type of reset that occurred. refer to section 5 for further information. figure 2-2 illustrates a typical reset circuit that includes an external switch together with a low voltage inhibit circuit, to prevent power transitions, or ram or eeprom corruption. figure 2-2 external reset circuitry v dd 1f v dd 4.7 k w to m68hc11 reset v dd 1 2 3 1 2 3 in reset gnd in reset gnd mc34064 mc34164 manual reset 4.7 k w 4.7 k w tpg 20
MC68HC11KW1 motorola 2-3 pin descriptions 2 2.2 crystal driver and external clock input (xtal, extal) these two pins provide the interface for either a crystal or a cmos compatible clock to control the internal clock generator circuitry. the frequency applied to these pins must be four times higher than the desired e clock rate. refer to figure 2-3. the xtal pin is normally left unconnected when an external cmos compatible clock input is connected to the extal pin. the xtal output is normally intended to drive only a crystal. the xtal output can be buffered with a high-impedance buffer, or it can be used to drive the extal input of another m68hc11 family device. in all cases, use caution when designing circuitry associated with the oscillator pins. figure 2-3 oscillator connections 10 m w 25 pf 4? crystal 25 pf extal xtal m68hc11 note: capacitor v alues include all stray capacitance. m68hc11 extal xtal nc exter nal oscillator 10 m w 25 pf 4? crystal 25 pf extal xtal m68hc11 m68hc11 extal xtal nc 220 w (a) common cr ystal connections (b) external oscillator connections (c) one crystal driving two mcus tpg 21
motorola 2-4 MC68HC11KW1 pin descriptions 2 2.3 vdd and vss power is supplied to the microcontroller via these pins. vdd is the positive supply and vss is ground. the mcu operates from a 5v (nominal) power supply. it is in the nature of cmos designs that very fast signal transitions occur on the mcu pins. these short rise and fall times place very high short-duration current demands on the power supply. to prevent noise problems, special care must be taken to provide good power supply bypassing at the mcu. bypass capacitors should have good high-frequency characteristics and be as close to the mcu as possible. bypassing requirements vary, depending on how heavily the mcu pins are loaded. the MC68HC11KW1 has four vdd pins and four vss pins. one pair of these pins is reserved for supplying power to the analog-to-digital converter (vddad, vssad); the remaining pins are used for the internal logic, and to supply power to the port logic on either half of the chip. 2.4 e clock output (e) e is the output connection for the internally generated e clock. the signal from e is used as a timing reference. the frequency of the e clock output is one quarter that of the input frequency at the xtal and extal pins. when e clock output is low, an internal process is taking place; when it is high, data is being accessed. all clocks, including the e clock, are halted when the mcu is in stop mode. the e clock output can be turned off in single-chip modes to reduce the effects of rfi (see section 4.3.2.5). 2.5 xout the xout pin outputs the buffered clkx signal, if enabled by the xclk bit in the config register. the frequency of clkx can be selected using two bits in the opt2 register (xdv1 and xdv2). on reset, clkx has the same frequency as extal (4e). see section 4. note that the phase relationship between clkx and extal cannot be predicted. 2.6 interrupt request (irq ) the irq input provides a means of applying asynchronous interrupt requests to the mcu. either falling-edge-sensitive triggering or level-sensitive triggering is program selectable (option register). irq is always con?ured to level-sensitive-triggering at reset. note: connect an external pull-up resistor, typically 4.7 k w , to vdd when irq is used in a level sensitive wired-or con?uration. see also section 2.7. tpg 22
MC68HC11KW1 motorola 2-5 pin descriptions 2 2.7 nonmaskable interrupt (xirq ) the xirq input provides a means of requesting a nonmaskable interrupt after reset initialization. during reset, the x bit in the condition code register (ccr) is set and any interrupt is masked until mcu software enables it. xirq is often used as a power loss detect interrupt. whenever xirq or irq is used with multiple interrupt sources (irq must be con?ured for level-sensitive operation if there is more than one source of interrupt), each source must drive the interrupt input with an open-drain type of driver to avoid contention between outputs. there should be a single pull-up resistor near the mcu interrupt input pin (typically 4.7 k w ). there must also be an interlock mechanism at each interrupt source so that the source holds the interrupt line low until the mcu recognizes and acknowledges the interrupt request. if one or more interrupt source is still pending after the mcu services a request, the interrupt line will still be held low and the mcu will be interrupted again as soon as the interrupt mask bit in the mcu is cleared (normally upon return from an interrupt). refer to section 5. 2.8 moda and modb (moda/lir and modb/vstby) during reset, moda and modb select one of the four operating modes. refer to section 4. after the operating mode has been selected, the lir pin provides an open-drain output (driven low) to indicate that execution of an instruction has begun. in order to detect consecutive instructions in a high-speed application, this signal drives high for a short time to prevent false triggering. a series of e clock cycles occurs during execution of each instruction. the lir signal goes low during the ?st e clock cycle of each instruction (opcode fetch). this output is provided for assistance in program debugging, and its operation is controlled by the lirdv bit in the opt2 register. the vstby pin is used to input ram stand-by power. the mcu is powered from the vdd pin unless the difference between the level of v stby and v dd is greater than one mos threshold (about 0.7 volts). when these voltages differ by more than 0.7 volts, the internal ram and part of the reset logic are powered from v stby rather than v dd . this allows ram contents to be retained without vdd power applied to the mcu. reset must be driven low before v dd is removed and must remain low until v dd has been restored to a valid level. figure 2-4 ram stand-by connections 4.7k w (+) 4.8 v nicd v dd v dd v out v batt max 690 to modb/vstby pin of m68hc11 tpg 23
motorola 2-6 MC68HC11KW1 pin descriptions 2 2.9 vrh and vrl these pins provide the reference voltages for the analog-to-digital converter. 2.10 r/w in expanded and test modes, r/w performs the read/write function. r/w signals the direction of transfers on the external data bus. a high on this pin indicates that a read cycle is in progress. in single chip mode the r/w signal is driven low. 2.11 port signals the MC68HC11KW1 includes 80 pins that are arranged into ten 8-bit ports (a, b, c, d, e, f, g, h, j and k). all the port pins are bidirectional, except for pg7, pg6 and port e pins [7:0]; these are input only. most of the bidirectional ports serve a purpose other than i/o, depending on the operating mode or peripheral function selected. the input-only pins may be used as general-purpose inputs, or as inputs to the a/d converter. note that ports b, c, and f are available for i/o functions only in single chip and bootstrap modes. refer to table 2-1 for details of the port signals functions in different operating modes. note: when using the information about port functions, do not confuse pin function with the electrical state of the pin at reset. all general purpose i/o pins con?ured as inputs at reset are in a high-impedance state. port data registers re?ct the functional state of the port at reset. the pin function is mode dependent. 2.11.1 port a port a is an 8-bit, general-purpose i/o port with a data register (porta) and a data direction register (ddra). port a pins share functions with the main 16-bit timer system, timer 1 (see section 9 for further information). porta can be read at any time and always returns the pin level. if written, porta stores the data in internal latches. the pins are driven only if they are con?ured as outputs. writes to porta do not change the pin state when the pins are con?ured for timer output compares. out of reset, port a pins [7:0] are general purpose high-impedance inputs. when the functions associated with these pins are disabled, the bits in ddra govern the i/o state of the associated pin. for further information, refer to section 6. tpg 24
MC68HC11KW1 motorola 2-7 pin descriptions 2 table 2-1 port signal functions port/bit single chip and bootstrap mode expanded m ultiplexed and special test mode pa7 pa7/pai and/or oc1 pa6 pa6/oc2 and/or oc1 pa5 pa5/oc3 and/or oc1 pa4 pa4/oc4 and/or oc1 pa3 pa3/oc5/ic4 and/or oc1 pa2 pa2/ic1 pa1 pa1/ic2 pa0 pa0/ic3 pb[7:0] pb[7:0] addr[15:8] pc[7:0] pc[7:0] data[7:0] pd[7,6] pd[7, 6] pd5 pd5/ss pd4 pd4/sck pd3 pd3/mosi pd2 pd2/miso pd1 pd1/txd pd0 pd0/rxd pe[7:0] input only / analog inputs pf[7:0] pf[7:0] addr[7:0] pg[7,6] input only / analog inputs pg[5:0] pg[5:0] pg[5:0] / xa[18:13] ph7 ph7 ph7 / cspr og ph6 ph6 ph6 / csgp2 ph5 ph5 ph5 / csgp1 ph4 ph4 ph4 / csio ph[3:0] ph[3:0] / pwm[4:1] pj7 pj7 / c4 pj6 pj6 / oc3 pj5 pj5 / oc2 pj4 pj4 / oc1 pj3 pj3 / ecin pj[2,0] pj[2,0] pk7 pk7 / c4 pk6 pk6 / oc3 pk5 pk5 / oc2 pk4 pk4 / oc1 pk3 pk3 / ecin pk[2,0] pk[2,0] tpg 25
motorola 2-8 MC68HC11KW1 pin descriptions 2 2.11.2 port b port b is an 8-bit, general-purpose i/o port with a data register (portb) and a data direction register (ddrb). in single chip mode, port b pins are general purpose i/o pins (pb[7:0]). in expanded mode, port b pins act as the high-order address lines (addr[15:8]) of the address bus. portb can be read at any time and always returns the pin level. if portb is written, the data is stored in internal latches. the pins are driven only if they are con?ured as outputs in single chip or bootstrap mode. for further information, refer to section 6. port b pins include on-chip pull-up devices which can be enabled or disabled via the port pull-up assignment register (ppar). 2.11.3 port c port c is an 8-bit, general-purpose i/o port with a data register (portc) and a data direction register (ddrc). in single chip mode, port c pins are general purpose i/o pins (pc[7:0]). in the expanded mode, port c pins are con?ured as data bus pins (data[7:0]). portc can be read at any time; inputs return the pin level and outputs return the pin driver input level. if portc is written, the data is stored in internal latches. the pins are driven only if they are con?ured as outputs in single chip or bootstrap mode. port c pins are general purpose inputs out of reset in single chip and bootstrap modes. in expanded and test modes, these pins are data bus lines out of reset. the cwom control bit in the opt2 register disables port cs p-channel output drivers. because the n-channel driver is not affected by cwom, setting cwom causes port c to become an open-drain-type output port suitable for wired-or operation. in wired-or mode (portc bits at logic level zero), the pins are actively driven low by the n-channel driver. when a port c bit is at logic level one, the associated pin is in a high impedance state as neither the n-channel nor the p-channel devices are active. it is customary to have an external pull-up resistor on lines that are driven by open-drain devices. port c can only be con?ured for wired-or operation when the mcu is in single chip mode. for further information, refer to section 6. 2.11.4 port d port d, an 8-bit, general-purpose i/o port, has a data register (portd) and a data direction register (ddrd). all the port d pins can be used for general purpose i/o, and pins [5:0] can also be used for the serial peripheral interface (spi, pins [5:2]) and the serial communications interface (sci, pins [1,0]). portd can be read at any time; inputs return the pin level and outputs return the pin driver input level. if portd is written, the data is stored in internal latches. the pins are driven only if port d is con?ured for general purpose output. tpg 26
MC68HC11KW1 motorola 2-9 pin descriptions 2 the dwom bit in spcr disables the p-channel output drivers of pins d[5:2], and the woms bit in sccr1 disables those of pins d[1,0]. because the n-channel driver is not affected by dwom or woms, setting either bit causes the corresponding port d pins to become open-drain-type outputs suitable for wired-or operation. in wired-or mode (portd bits at logic level zero), the pins are actively driven low by the n-channel driver. when a port d bit is at logic level one, the associated pin is in a high impedance state as neither the n-channel nor the p-channel devices are active. it is customary to have an external pull-up resistor on lines that are driven by open-drain devices. port d can be con?ured for wired-or operation when the mcu is in single chip or expanded mode. for further information, refer to section 6, section 7 (sci) and section 8 (spi). 2.11.5 port e port e pins can be used as the analog inputs for the analog-to-digital converter, or as general-purpose inputs. for further information, refer to section 6 and section 10 (a/d). 2.11.6 port f port f is an 8-bit, general-purpose i/o port with a data register (portf) and a data direction register (ddrf). in single chip mode, port f pins are general purpose i/o pins (pf[7:0]). in expanded mode, port f pins act as the low-order address lines (addr[7:0]) of the address bus. portf can be read at any time and always returns the pin level. if portf is written, the data is stored in internal latches. the pins are driven only if they are con?ured as outputs in single chip or bootstrap mode. port f pins include on-chip pull-up devices that can be enabled or disabled via the port pull-up assignment register (ppar). for further information, refer to section 6. 2.11.7 port g in normal modes, port g is an 8-bit general-purpose port with 6 i/o lines (pg[5:0]), and two input only lines (pg[7, 6]). associated with port g are a data register (portg), a data direction register (ddrg) and an assignment register (pgar). pins [7, 6] can be used as general-purpose inputs, or as inputs to the analog-to-digital converter. the functions of pins [5:0] are controlled by bits in the port g assignment register (pgar), which select whether the pins are used for general purpose i/o, or, in expanded mode, for the memory expansion lines xa[18:13]. portg can be read at any time and always returns the pin level. if portg is written, the data is stored into an internal latch. the pin is driven only if it is con?ured as an output. pins [5:0] have on-chip pull-up devices that can be enabled or disabled via the port pull-up assignment register (ppar). refer to section 6, section 10 (a/d) and section 4. tpg 27
motorola 2-10 MC68HC11KW1 pin descriptions 2 2.11.8 port h port h is an 8-bit general-purpose i/o port with a data register (porth) and a data direction register (ddrh). port h lines can be used for general-purpose i/o, for chip select lines (ph[7:4]), and for the pulse width modulation timer (pwm, ph[3:0]). porth can be read at any time and always returns the pin level. if porth is written, the data is stored into an internal latch. the pin is driven only if it is con?ured as an output. port h pins include on-chip pull-up devices that can be enabled or disabled via the port pull-up assignment register (ppar). for further information, refer to section 6, section 9 (timing system) and section 4. 2.11.9 port j port j is an 8-bit, general-purpose i/o port with a data register (portj) and a data direction register (ddrj). port j lines can be used for general-purpose i/o, and pins [7:3] share functions with one of the 16-bit timers, timer 2. portj can be read at any time and always returns the pin level. if written, portj stores the data in internal latches. the pins are driven only if they are con?ured as outputs. writes to portj do not change the pin state when the pins are con?ured for timer output compares. out of reset, port j pins [7:0] are general purpose high-impedance inputs. when the functions associated with these pins are disabled, the bits in ddrj govern the i/o state of the associated pin. for further information, refer to section 6 and section 9 (timing system). 2.11.10 port k port k is an 8-bit general-purpose i/o port with a data register (portk) and a data direction register (ddrk). port k lines can be used for general-purpose i/o, and pins [7:3] share functions with one of the 16-bit timers, timer 3. portk can be read at any time and always returns the pin level. if written, portk stores the data in internal latches. the pins are driven only if they are con?ured as outputs. writes to portk do not change the pin state when the pins are con?ured for timer output compares. out of reset, port k pins [7:0] are general purpose high-impedance inputs. when the functions associated with these pins are disabled, the bits in ddrk govern the i/o state of the associated pin. for further information, refer to section 6 and section 9 (timing system). tpg 28
MC68HC11KW1 motorola 3-1 central processing unit 3 3 central processing unit this section discusses the m68hc11 central processing unit (cpu) architecture, its addressing modes and the instruction set. for more detailed information on the instruction set, refer to the m68hc11 reference manual (m68hc11rm/ad) . the cpu is designed to treat all peripheral, i/o and memory locations identically, as addresses in the 64kbyte memory map. this is referred to as memory-mapped i/o. there are no special instructions for i/o that are separate from those used for memory. this architecture also allows accessing an operand from an external memory location with no execution-time penalty. 3.1 registers m68hc11 cpu registers are an integral part of the cpu and are not addressed as if they were memory locations. the seven registers are shown in figure 3-1 and are discussed in the following paragraphs. figure 3-1 programming model accum ulator a 7 0 accum ulator b 70 double accum ulator d 15 0 index register x 15 0 index register y 15 0 stack pointer 15 0 program counter 15 0 sc xhinzv a:b d ix iy sp pc ccr condition code register carry overflow zero negative i interr upt mask half carry (from bit 3) x interr upt mask stop disable tpg 29
motorola 3-2 MC68HC11KW1 central processing unit 3 3.1.1 accumulators a, b and d accumulators a and b are general purpose 8-bit registers that hold operands and results of arithmetic calculations or data manipulations. for some instructions, these two accumulators are treated as a single double-byte (16-bit) accumulator called accumulator d. although most operations can use accumulators a or b interchangeably, the following exceptions apply: the abx and aby instructions add the contents of 8-bit accumulator b to the contents of 16-bit register x or y, but there are no equivalent instructions that use a instead of b. the tap and tpa instructions transfer data from accumulator a to the condition code register, or from the condition code register to accumulator a, however, there are no equivalent instructions that use b rather than a. the decimal adjust accumulator a (daa) instruction is used after binary-coded decimal (bcd) arithmetic operations, but there is no equivalent bcd instruction to adjust accumulator b. the add, subtract, and compare instructions associated with both a and b (aba, sba, and cba) only operate in one direction, making it important to plan ahead to ensure the correct operand is in the correct accumulator. 3.1.2 index register x (ix) the ix register provides a 16-bit indexing value that can be added to the 8-bit offset provided in an instruction to create an effective address. the ix register can also be used as a counter or as a temporary storage register. 3.1.3 index register y (iy) the 16-bit iy register performs an indexed mode function similar to that of the ix register. however, most instructions using the iy register require an extra byte of machine code and an extra cycle of execution time because of the way the opcode map is implemented. refer to section 3.3 for further information. 3.1.4 stack pointer (sp) the m68hc11 cpu has an automatic program stack. this stack can be located anywhere in the address space and can be any size up to the amount of memory available in the system. normally the sp is initialized by one of the ?st instructions in an application program. the stack is con?ured as a data structure that grows downward from high memory to low memory. each time a new byte is pushed onto the stack, the sp is decremented. each time a byte is pulled from the stack, the sp is incremented. at any given time, the sp holds the 16-bit address of the next free location in the stack. figure 3-2 is a summary of sp operations. tpg 30
MC68HC11KW1 motorola 3-3 central processing unit 3 figure 3-2 stacking operations $9d = jsr main program jsr, jump to subroutine pc direct dd ff main program next instr uction rtn $ad = jsr pc next instr uction rtn $18 = pre pc main program $ad = jsr ff next instr uction rtn $bd = jsr pc hh ll next instr uction rtn main program $8d = bsr pc rr main program next instr uction rtn bsr, branch to subroutine $39 = rts pc main program ind, x ind, y extend rtn l sp rtn h sp? sp? stack rtn l sp rtn h sp? sp? stack rtn l sp+2 rtn h sp+1 sp stack $3b = rti pc sp condition code sp+1 rti, return from interrupt inter rupt program stack accum ulator b sp+2 accum ulator a sp+3 index register (ix h ) sp+4 index register (ix l ) sp+5 index register (iy h ) sp+6 index register (iy l ) sp+7 rtn h sp+8 rtn l sp+9 $3f = swi pc rtn sp? condition code sp? main program stack accum ulator b sp? accum ulator a sp? index register (ix h ) sp? index register (ix l ) sp? index register (iy h ) sp? index register (iy l ) sp? rtn h sp? swi, software interrupt rtn l sp wai, wait for interrupt $3e = wai pc rtn main program rts, return from subr outine legend rtn address of the next instr uction in the main program, to be executed on return from subroutine rtn h more signi?ant b yte of return address rtn l less signi?ant byte of return address shaded cells show stack pointer position after the operation is complete dd 8-bit direct address ($0000?00ff); the high byte is assumed to be $00 ff 8-bit positive offset ($00 to $ff (0 to 256)) is added to the index register contents hh high order byte of 16-bit e xtended address ll low order b yte of 16-bit e xtended address rr signed relative offset ($80 to $7f (?28 to +127)); offset is relative to the address following the offset byte tpg 31
motorola 3-4 MC68HC11KW1 central processing unit 3 when a subroutine is called by a jump to subroutine (jsr) or branch to subroutine (bsr) instruction, the address of the instruction after the jsr or bsr is automatically pushed onto the stack, less signi?ant byte ?st. when the subroutine is ?ished, a return from subroutine (rts) instruction is executed. the rts pulls the previously stacked return address from the stack, and loads it into the program counter. execution then continues at this recovered return address. when an interrupt is recognized, the current instruction ?ishes normally, the return address (the current value in the program counter) is pushed onto the stack, all of the cpu registers are pushed onto the stack, and execution continues at the address speci?d by the vector for the interrupt. at the end of the interrupt service routine, an rti instruction is executed. the rti instruction causes the saved registers to be pulled off the stack in reverse order. program execution resumes at the return address. there are instructions that push and pull the a and b accumulators and the x and y index registers. these instructions are often used to preserve program context. for example, pushing accumulator a onto the stack when entering a subroutine that uses accumulator a, and then pulling accumulator a off the stack just before leaving the subroutine, ensures that the contents of a register will be the same after returning from the subroutine as it was before starting the subroutine. 3.1.5 program counter (pc) the program counter, a 16-bit register, contains the address of the next instruction to be executed. after reset, the program counter is initialized from one of six possible vectors, depending on operating mode and the cause of reset. 3.1.6 condition code register (ccr) this 8-bit register contains ?e condition code indicators (c, v, z, n, and h), two interrupt masking bits, (irq and xirq) and a stop disable bit (s). in the m68hc11 cpu, condition codes are automatically updated by most instructions. for example, load accumulator a (ldaa) and store accumulator a (staa) instructions automatically set or clear the n, z, and v condition code ?gs. pushes, pulls, add b to x (abx), add b to y (aby), and transfer/exchange instructions do not affect the condition codes. refer to table 3-2, which shows the condition codes that are affected by a particular instruction. table 3-1 reset vector comparison por or reset pin clock monitor cop watchdog normal $fffe, $ffff $fffc, $fffd $fffa, $fffb test or boot $bffe, $bfff $bffe, $bfff $bffe, $bfff tpg 32
MC68HC11KW1 motorola 3-5 central processing unit 3 3.1.6.1 carry/borrow (c) the c-bit is set if the arithmetic logic unit (alu) performs a carry or borrow during an arithmetic operation. the c-bit also acts as an error ?g for multiply and divide operations. shift and rotate instructions operate with and through the carry bit to facilitate multiple-word shift operations. 3.1.6.2 over?w (v) the over?w bit is set if an operation causes an arithmetic over?w. otherwise, the v-bit is cleared. 3.1.6.3 zero (z) the z-bit is set if the result of an arithmetic, logic, or data manipulation operation is zero. otherwise, the z-bit is cleared. compare instructions do an internal implied subtraction and the condition codes, including z, re?ct the results of that subtraction. a few operations (inx, dex, iny, and dey) affect the z-bit and no other condition ?gs. for these operations, only = and 1 conditions can be determined. 3.1.6.4 negative (n) the n-bit is set if the result of an arithmetic, logic, or data manipulation operation is negative; otherwise, the n-bit is cleared. a result is said to be negative if its most signi?ant bit (msb) is set (msb = 1). a quick way to test whether the contents of a memory location has the msb set is to load it into an accumulator and then check the status of the n-bit. 3.1.6.5 interrupt mask (i) the interrupt request (irq) mask (i-bit) is a global mask that disables all maskable interrupt sources. while the i-bit is set, interrupts can become pending, but the operation of the cpu continues uninterrupted until the i-bit is cleared. after any reset, the i-bit is set by default and can only be cleared by a software instruction. when an interrupt is recognized, the i-bit is set after the registers are stacked, but before the interrupt vector is fetched. after the interrupt has been serviced, a return from interrupt instruction is normally executed, restoring the registers to the values that were present before the interrupt occurred. normally, the i-bit is zero after a return from interrupt is executed. although the i-bit can be cleared within an interrupt service routine, ?esting interrupts in this way should only be done when there is a clear understanding of latency and of the arbitration mechanism. refer to section 5. tpg 33
motorola 3-6 MC68HC11KW1 central processing unit 3 3.1.6.6 half carry (h) the h-bit is set when a carry occurs between bits 3 and 4 of the arithmetic logic unit during an add, aba, or adc instruction. otherwise, the h-bit is cleared. half carry is used during bcd operations. 3.1.6.7 x interrupt mask (x) the xirq mask (x) bit disables interrupts from the xirq pin. after any reset, x is set by default and must be cleared by a software instruction. when an xirq interrupt is recognized, the x- and i-bits are set after the registers are stacked, but before the interrupt vector is fetched. after the interrupt has been serviced, an rti instruction is normally executed, causing the registers to be restored to the values that were present before the interrupt occurred. the x interrupt mask bit is set only by hardware reset or xirq acknowledge). x is cleared only by program instruction (tap, where the associated bit of a is 0; or rti, where bit 6 of the value loaded into the ccr from the stack has been cleared). there is no hardware action for clearing x. 3.1.6.8 stop disable (s) setting the stop disable (s) bit prevents the stop instruction from putting the m68hc11 into a low-power stop condition. if the stop instruction is encountered by the cpu while the s-bit is set, it is treated as a no-operation (nop) instruction, and processing continues to the next instruction. s is set by reset ?stop disabled by default. 3.2 data types the m68hc11 cpu supports the following data types: bit data 8-bit and 16-bit signed and unsigned integers 16-bit unsigned fractions 16-bit addresses a byte is eight bits wide and can be accessed at any byte location. a word is composed of two consecutive bytes with the most signi?ant byte at the lower value address. because the m68hc11 is an 8-bit cpu, there are no special requirements for alignment of instructions or operands. tpg 34
MC68HC11KW1 motorola 3-7 central processing unit 3 3.3 opcodes and operands the m68hc11 family of microcontrollers uses 8-bit opcodes. each opcode identi?s a particular instruction and associated addressing mode to the cpu. several opcodes are required to provide each instruction with a range of addressing capabilities. only 256 opcodes would be available if the range of values were restricted to the number able to be expressed in 8-bit binary numbers. a four-page opcode map has been implemented to expand the number of instructions. an additional byte, called a prebyte, directs the processor from page 0 of the opcode map to one of the other three pages. as its name implies, the additional byte precedes the opcode. a complete instruction consists of a prebyte, if any, an opcode, and zero, one, two, or three operands. the operands contain information the cpu needs for executing the instruction. complete instructions can be from one to ?e bytes long. 3.4 addressing modes six addressing modes; immediate, direct, extended, indexed, inherent, and relative, detailed in the following paragraphs, can be used to access memory. all modes except inherent mode use an effective address. the effective address is the memory address from which the argument is fetched or stored, or the address from which execution is to proceed. the effective address can be speci?d within an instruction, or it can be calculated. 3.5 immediate (imm) in the immediate addressing mode an argument is contained in the byte(s) immediately following the opcode. the number of bytes following the opcode matches the size of the register or memory location being operated on. there are two, three, and four (if prebyte is required) byte immediate instructions. the effective address is the address of the byte following the instruction. 3.5.1 direct (dir) in the direct addressing mode, the low-order byte of the operand address is contained in a single byte following the opcode, and the high-order byte of the address is assumed to be $00. addresses $00?ff are thus accessed directly, using two-byte instructions. execution time is reduced by eliminating the additional memory access required for the high-order address byte. in most applications, this 256-byte area is reserved for frequently referenced data. in m68hc11 mcus, the memory map can be con?ured for combinations of internal registers, ram, or external memory to occupy these addresses. tpg 35
motorola 3-8 MC68HC11KW1 central processing unit 3 3.5.2 extended (ext) in the extended addressing mode, the effective address of the argument is contained in two bytes following the opcode byte. these are three-byte instructions (or four-byte instructions if a prebyte is required). one or two bytes are needed for the opcode and two for the effective address. 3.5.3 indexed (ind, x; ind, y) in the indexed addressing mode, an 8-bit unsigned offset contained in the instruction is added to the value contained in an index register (ix or iy) ?the sum is the effective address. this addressing mode allows referencing any memory location in the 64kbyte address space. these are two- to ?e-byte instructions, depending on whether or not a prebyte is required. 3.5.4 inherent (inh) in the inherent addressing mode, all the information necessary to execute the instruction is contained in the opcode. operations that use only the index registers or accumulators, as well as control instructions with no arguments, are included in this addressing mode. these are one or two-byte instructions. 3.5.5 relative (rel) the relative addressing mode is used only for branch instructions. if the branch condition is true, an 8-bit signed offset included in the instruction is added to the contents of the program counter to form the effective branch address. otherwise, control proceeds to the next instruction. these are usually two-byte instructions. 3.6 instruction set refer to table 3-2, which shows all the m68hc11 instructions in all possible addressing modes. for each instruction, the table shows the operand construction, the number of machine code bytes, and execution time in cpu e clock cycles. tpg 36
MC68HC11KW1 motorola 3-9 central processing unit 3 table 3-2 instruction set (page 1 of 6) mnemonic operation description addressing mode instruction condition codes opcode operand cycles s x h i n z v c aba add accum ulators a + b t a inh 1b 2 d dddd abx add b to x ix + (00:b) t ix inh 3a 3 aby add b to y iy + (00:b) t iy inh 18 3a 4 adca (opr) add with carry to a a + m + c t a a imm a dir a ext a ind, x a ind, y 89 99 b9 a9 18 a9 ii dd hh ll ff ff 2 3 4 4 5 d dddd adcb (opr) add with carry to b b + m + c t b b imm b dir b ext b ind, x b ind, y c9 d9 f9 e9 18 e9 ii dd hh ll ff ff 2 3 4 4 5 d dddd adda (opr) add memory to a a + m t a a imm a dir a ext a ind, x a ind, y 8b 9b bb ab 18 ab ii dd hh ll ff ff 2 3 4 4 5 d dddd addb (opr) add memory to b b + m t b b imm b dir b ext b ind, x b ind, y cb db fb eb 18 eb ii dd hh ll ff ff 2 3 4 4 5 d dddd addd (opr) add 16-bit to d d + (m:m+1) t d imm dir ext ind, x ind, y c3 d3 f3 e3 18 e3 jj kk dd hh ll ff ff 4 5 6 6 7 dddd anda (opr) and a with memory a m t a a imm a dir a ext a ind, x a ind, y 84 94 b4 a4 18 a4 ii dd hh ll ff ff 2 3 4 4 5 dd 0 andb (opr) and b with memory b m t b b imm b dir b ext b ind, x b ind, y c4 d4 f4 e4 18 e4 ii dd hh ll ff ff 2 3 4 4 5 dd 0 asl (opr) ar ithmetic shift left ext ind, x ind, y 78 68 18 68 hh ll ff ff 6 6 7 dddd asla ar ithmetic shift left a a inh 48 2 dddd aslb ar ithmetic shift left b b inh 58 2 dddd asld ar ithmetic shift left d inh 05 3 dddd asr arithmetic shift right ext ind, x ind, y 77 67 18 67 hh ll ff ff 6 6 7 dddd asra ar ithmetic shift right a a inh 47 2 dddd asrb ar ithmetic shift right b b inh 57 2 dddd bcc (rel) branch if carry clear c = 0 ? rel 24 rr 3 bclr (opr) (msk) clear bit(s) m ?(mm ) t m dir ind, x ind, y 15 1d 18 1d dd mm ff m m ff m m 6 7 8 dd 0 bcs (rel) branch if carry set c = 1 ? rel 25 rr 3 beq (rel) branch if equal to zero z = 1 ? rel 27 rr 3 bge (rel) br anch if 3 zero n ? v = 0 ? rel 2c rr 3 bgt (rel) branch if > zero z + (n ? v) = 0 ? rel 2e rr 3 bhi (rel) branch if higher c + z = 0 ? rel 22 rr 3 b7 b0 c 0 b15 b0 c 0 b7 b0 c tpg 37
motorola 3-10 MC68HC11KW1 central processing unit 3 bhs (rel) branch if higher or same c = 0 ? rel 24 rr 3 bita (opr) bit(s) test a with memory a m a imm a dir a ext a ind, x a ind, y 85 95 b5 a5 18 a5 ii dd hh ll ff ff 2 3 4 4 5 dd 0 bitb (opr) bit(s) test b with memory b ?m b imm b dir b ext b ind, x b ind, y c5 d5 f5 e5 18 e5 ii dd hh ll ff ff 2 3 4 4 5 dd 0 ble (rel) branch if zero z + (n ? v) = 1 ? rel 2f rr 3 blo (rel) branch if lower c = 1 ? rel 25 rr 3 bls (rel) branch if lower or same c + z = 1 ? rel 23 rr 3 blt (rel) branch if < zero n ? v = 1 ? rel 2d rr 3 bmi (rel) branch if minus n = 1 ? rel 2b rr 3 bne (rel) branch if 1 zero z = 0 ? rel 26 rr 3 bpl(rel) branch if plus n = 0 ? rel 2a rr 3 bra (rel) branch always 1 = 1 ? rel 20 rr 3 brclr(opr) (msk) (rel) branch if bit(s) clear m mm = 0 ? dir ind, x ind, y 13 1f 18 1f dd mm rr ff mm rr ff mm rr 6 7 8 brn (rel) branch never 1 = 0 ? rel 21 rr 3 brset(opr) (msk) (rel) branch if bit(s) set m ?mm = 0 ? dir ind, x ind, y 12 1e 18 1e dd mm rr ff mm rr ff mm rr 6 7 8 bset (opr) (msk) set bit(s) m + mm t m dir ind, x ind, y 14 1c 18 1c dd mm ff m m ff m m 6 7 8 dd 0 bsr (rel) branch to subroutine see figure 3-2 rel 8d rr 6 bvc (rel) branch if over?w clear v = 0 ? rel 28 rr 3 bvs (rel) branch if over?w set v = 1 ? rel 29 rr 3 cba compare a with b a ?b inh 11 2 dddd clc clear carry bit 0 t c inh 0c 2 0 cli clear interr upt mask 0 t i inh 0e 2 0 clr (opr) clear memory byte 0 t m dir ind, x ind, y 7f 6f 18 6f hh ll ff ff 6 6 7 0100 clra clear accum ulator a 0 t a a inh 4f 2 0100 clrb clear accum ulator b 0 t b b inh 5f 2 0100 clv clear over?w ag 0 t v inh 0a 2 0 cmpa (opr) compare a with memory a ?m a imm a dir a ext a ind, x a ind, y 81 91 b1 a1 18 a1 ii dd hh ll ff ff 2 3 4 4 5 dddd cmpb (opr) compare b with memory b ?m b imm b dir b ext b ind, x b ind, y c1 d1 f1 e1 18 e1 ii dd hh ll ff ff 2 3 4 4 5 dddd com (opr) ones complement memory byte $ff ?m t m ext ind, x ind, y 73 63 18 63 hh ll ff ff 6 6 7 dd 01 coma ones complement a $ff ?a t a a inh 43 2 dd 01 comb ones complement b $ff ?b t b b inh 53 2 dd 01 table 3-2 instruction set (page 2 of 6) mnemonic operation description addressing mode instruction condition codes opcode operand cycles s x h i n z v c tpg 38
MC68HC11KW1 motorola 3-11 central processing unit 3 cpd (opr) compare d with memory (16-bit) d (m:m+1) imm dir ext ind, x ind, y 1a 83 1a 93 1a b3 1a a3 cd a3 jj kk dd hh ll ff ff 5 6 7 7 7 dddd cpx (opr) compare ix with memory (16-bit) ix (m:m+1) imm dir ext ind, x ind, y 8c 9c bc ac cd ac jj kk dd hh ll ff ff 4 5 6 6 7 dddd cpy (opr) compare iy with memory (16-bit) iy (m:m+1) imm dir ext ind, x ind, y 18 8c 18 9c 18 bc 1a ac 18 ac jj kk dd hh ll ff ff 5 6 7 7 7 dddd daa decimal adjust a adjust sum to bcd inh 19 2 dd ? d dec (opr) decrement memory byte m 1 t m ext ind, x ind, y 7a 6a 18 6a hh ll ff ff 6 6 7 ddd deca decrement accum ulator a a ?1 t a a inh 4a 2 ddd decb decrement accum ulator b b ?1 t b b inh 5a 2 ddd des decrement stack pointer sp 1 t sp inh 34 3 dex decrement index register x ix ?1 t ix inh 09 3 d dey decrement index register y iy ?1 t iy inh 18 09 4 d eora (opr) exclusive or a with memory a ? m t a a imm a dir a ext a ind, x a ind, y 88 98 b8 a8 18 a8 ii dd hh ll ff ff 2 3 4 4 5 dd 0 eorb (opr) exclusive or b with memory b ? m t a b imm b dir b ext b ind, x b ind, y c8 d8 f8 e8 18 e8 ii dd hh ll ff ff 2 3 4 4 5 dd 0 fdiv fr actional divide, 16 by 16 d / ix t ix; r t d inh 03 41 ddd idiv integer divide, 16 by 16 d / ix t ix; r t d inh 02 41 d 0 d inc (opr) increment memory byte m + 1 t m ext ind, x ind, y 7c 6c 18 6c hh ll ff ff 6 6 7 ddd inca increment accum ulator a a + 1 t a a inh 4c 2 ddd incb increment accum ulator b b + 1 t b b inh 5c 2 ddd ins increment stack pointer sp + 1 t sp inh 31 3 inx increment index register x ix + 1 t ix inh 08 3 d iny increment index register y iy + 1 t iy inh 18 08 4 d jmp (opr) jump see figure 3-2 ext ind, x ind, y 7e 6e 18 6e hh ll ff ff 3 3 4 jsr (opr) jump to subroutine see figure 3-2 dir ext ind, x ind, y 9d bd ad 18 ad dd hh ll ff ff 5 6 6 7 ldaa (opr) load accum ulator a m t a a imm a dir a ext a ind, x a ind, y 86 96 b6 a6 18 a6 ii dd hh ll ff ff 2 3 4 4 5 dd 0 table 3-2 instruction set (page 3 of 6) mnemonic operation description addressing mode instruction condition codes opcode operand cycles s x h i n z v c tpg 39
motorola 3-12 MC68HC11KW1 central processing unit 3 ldab (opr) load accum ulator b m t b b imm b dir b ext b ind, x b ind, y c6 d6 f6 e6 18 e6 ii dd hh ll ff ff 2 3 4 4 5 dd 0 ldd (opr) load double accum ulator d m t a; m+1 t b imm dir ext ind, x ind, y cc dc fc ec 18 ec jj kk dd hh ll ff ff 3 4 5 5 6 dd 0 lds (opr) load stack pointer m:m+1 t sp imm dir ext ind, x ind, y 8e 9e be ae 18 ae jj kk dd hh ll ff ff 3 4 5 5 6 dd 0 ldx (opr) load index register x m:m+1 t ix imm dir ext ind, x ind, y ce de fe ee cd ee jj kk dd hh ll ff ff 3 4 5 5 6 dd 0 ldy (opr) load index register y m:m+1 t iy imm dir ext ind, x ind, y 18 ce 18 de 18 fe 1a ee 18 ee jj kk dd hh ll ff ff 4 5 6 6 6 dd 0 lsl (opr) logical shift left ext ind, x ind, y 78 68 18 68 hh ll ff ff 6 6 7 dddd lsla logical shift left a a inh 48 2 dddd lslb logical shift left b b inh 58 2 dddd lsld logical shift left d inh 05 3 dddd lsr (opr) logical shift right ext ind, x ind, y 74 64 18 64 hh ll ff ff 6 6 7 0 ddd lsra logical shift right a a inh 44 2 0 ddd lsrb logical shift right b b inh 54 2 0 ddd lsrd logical shift right d inh 04 3 0 ddd mul multiply, 8 x 8 a * b t d inh 3d 10 d neg (opr) twos complement memory byte 0 m t m ext ind, x ind, y 70 60 18 60 hh ll ff ff 6 6 7 dddd nega twos complement a 0 a t a a inh 40 2 dddd negb twos complement b 0 b t b b inh 50 2 dddd nop no oper ation no operation inh 01 2 oraa or accum ulator a (inclusive) a + m t a a imm a dir a ext a ind, x a ind, y 8a 9a ba aa 18 aa ii dd hh ll ff ff 2 3 4 4 5 dd 0 orab or accum ulator b (inclusive) b + m t b b imm b dir b ext b ind, x b ind, y ca da fa ea 18 ea ii dd hh ll ff ff 2 3 4 4 5 dd 0 psha push a onto stack a t stack; sp = sp? a inh 36 3 pshb push b onto stack b t stack; sp = sp? b inh 37 3 pshx push ix onto stack (low rst) ix t stack; sp = sp? inh 3c 4 pshy push iy onto stack (low rst) iy t stack; sp = sp? inh 18 3c 5 table 3-2 instruction set (page 4 of 6) mnemonic operation description addressing mode instruction condition codes opcode operand cycles s x h i n z v c b7 b0 c 0 b15 b0 c 0 b7 b0 0 c b15 b0 0 c tpg 40
MC68HC11KW1 motorola 3-13 central processing unit 3 pula pull a from stack sp = sp+1; stack t a a inh 32 4 pulb pull b from stack sp = sp+1; stack t b b inh 33 4 pulx pull ix from stack (high rst) sp = sp+2; stack t ix inh 38 5 puly pull iy from stack (high rst) sp = sp+2; stack t iy inh 18 38 6 rol (opr) rotate left ext ind, x ind, y 79 69 18 69 hh ll ff ff 6 6 7 dddd rola rotate left a a inh 49 2 dddd rolb rotate left b b inh 59 2 dddd ror (opr) rotate r ight ext ind, x ind, y 76 66 18 66 hh ll ff ff 6 6 7 dddd rora rotate right a a inh 46 2 dddd rorb rotate right b b inh 56 2 dddd rti return from interrupt see figure 3-2 inh 3b 12 d dddddd rts return from subroutine see figure 3-2 inh 39 5 sba subtract b from a a ?b t a inh 10 2 dddd sbca (opr) subtr act with carry from a a m c t a a imm a dir a ext a ind, x a ind, y 82 92 b2 a2 18 a2 ii dd hh ll ff ff 2 3 4 4 5 dddd sbcb (opr) subtr act with carry from b b m c t b b imm b dir b ext b ind, x b ind, y c2 d2 f2 e2 18 e2 ii dd hh ll ff ff 2 3 4 4 5 dddd sec set carry 1 t c inh 0d 2 1 sei set interr upt mask 1 t i inh 0f 2 1 sev set over?w ag 1 t v inh 0b 2 1 staa (opr) store accum ulator a a t m a dir a ext a ind, x a ind, y 97 b7 a7 18 a7 dd hh ll ff ff 3 4 4 5 dd 0 stab (opr) store accum ulator b b t m b dir b ext b ind, x b ind, y d7 f7 e7 18 e7 dd hh ll ff ff 3 4 4 5 dd 0 std (opr) store accum ulator d a t m; b t m+1 dir ext ind, x ind, y dd fd ed 18 ed dd hh ll ff ff 4 5 5 6 dd 0 stop stop internal clocks inh cf 2 sts (opr) store stack pointer sp t m:m+1 dir ext ind, x ind, y 9f bf af 18 af dd hh ll ff ff 4 5 5 6 dd 0 stx (opr) store index register x ix t m:m+1 dir ext ind, x ind, y df ff ef cd ef dd hh ll ff ff 4 5 5 6 dd 0 sty (opr) store index register y iy t m:m+1 dir ext ind, x ind, y 18 df 18 ff 1a ef 18 ef dd hh ll ff ff 5 6 6 6 dd 0 table 3-2 instruction set (page 5 of 6) mnemonic operation description addressing mode instruction condition codes opcode operand cycles s x h i n z v c b7 b0 c b7 b0 c tpg 41
motorola 3-14 MC68HC11KW1 central processing unit 3 suba (opr) subtract memory from a a ?m t a a imm a dir a ext a ind, x a ind, y 80 90 b0 a0 18 a0 ii dd hh ll ff ff 2 3 4 4 5 dddd subb (opr) subtract memory from b b ?m t b b imm b dir b ext b ind, x b ind, y c0 d0 f0 e0 18 e0 ii dd hh ll ff ff 2 3 4 4 5 dddd subd (opr) subtract memory from d d ?m:m+1 t d imm dir ext ind, x ind, y 83 93 b3 a3 18 a3 jj kk dd hh ll ff ff 4 5 6 6 7 dddd swi softw are interrupt see figure 3-2 inh 3f 14 1 tab transfer a to b a t b inh 16 2 dd 0 tap transfer a to cc register a t ccr inh 06 2 d dddddd tba transfer b to a b t a inh 17 2 dd 0 test t est (only in test modes) address bus increments inh 00 ? tpa transfer cc register to a ccr t a inh 07 2 tst (opr) t est for z ero or minus m 0 ext ind, x ind, y 7d 6d 18 6d hh ll ff ff 6 6 7 dd 00 tsta test a for zero or minus a 0 a inh 4d 2 dd 00 tstb t est b for zero or minus b 0 b inh 5d 2 dd 00 tsx transfer stack pointer to x sp + 1 t ix inh 30 3 tsy transfer stack pointer to y sp + 1 t iy inh 18 30 4 txs transfer x to stack pointer ix 1 t sp inh 35 3 tys transfer y to stack pointer iy 1 t sp inh 18 35 4 wai wait for interrupt stack registers & wait inh 3e xgdx exchange d with x ix t d; d t ix inh 8f 3 xgdy exchange d with y iy t d; d t iy inh 18 8f 4 operators operands t is transferred to dd 8-bit direct address ($0000?00ff); the high byte is assumed boolean and to be zero + arithmetic addition, e xcept where used as an ff 8-bit positive offset ($00 to $ff (0 to 256)) is added to the inclusiv e-or symbol in boolean formulae contents of the index register ? exclusiv e-or hh high order byte of 16-bit e xtended address * multiply ii one b yte of immediate data : concatenation jj high order byte of 16-bit immediate data arithmetic subtraction, or negation symbol kk low order byte of 16-bit immediate data (twos complement) ll low order b yte of 16-bit e xtended address mm 8-bit mask (set bits to be affected) rr signed relative offset ($80 to $7f (?28 to +127)); offset is relative to the address following the offset byte cycles condition codes ? innite, or until reset occurs bit not changed 12 cycles are used, beginning with the opcode 0 bit always cleared fetch. a wait state is entered, which remains 1 bit always set in effect for an integer n umber of mpu e clock d bit set or cleared, depending on the operation cycles (n) until an interrupt is recognised. bit can be cleared, but cannot become set finally, two additional cycles are used to f etch ? not de?ed the appropr iate interrupt v ector. (14 + n, total). table 3-2 instruction set (page 6 of 6) mnemonic operation description addressing mode instruction condition codes opcode operand cycles s x h i n z v c tpg 42
MC68HC11KW1 motorola 4-1 operating modes and on-chip memory 4 4 operating modes and on-chip memory this section contains information about the modes that de?e MC68HC11KW1 operating conditions, and about the on-chip memory that allows the mcu to be con?ured for various applications. 4.1 operating modes the values of the mode select inputs modb and moda during reset determine the operating mode (see table 4-4). single chip and expanded modes are the normal modes. in single chip mode only on-board memory is available. expanded mode, however, allows access to external memory. each of these two normal modes is paired with a special mode. bootstrap, a variation of the single chip mode, is a special mode that executes a bootloader program in an internal bootstrap rom. test is a special expanded mode that allows privileged access to internal resources. 4.1.1 single chip operating mode in single chip operating mode, the MC68HC11KW1 microcontroller has no external address or data bus. ports b, c and f are available for general-purpose parallel i/o. 4.1.2 expanded operating mode in expanded operating mode, the mcu can access a 64k byte physical address space. the address space includes the same on-chip memory addresses used for single chip mode, in addition to external memory and peripheral devices.the expansion bus is made up of ports b, c, and f. in expanded mode, high order address bits are output on the port b pins, low order address bits on the port f pins, and the data bus on port c. the r/w pin signals the direction of data transfer on the port c bus. the MC68HC11KW1 includes an additional memory expansion feature, available in expanded modes, which allows access to pages of memory in one or two windows within the 64k byte physical memory space. this can extend the memory space to more than 1m byte. see section 4.4. tpg 43
motorola 4-2 MC68HC11KW1 operating modes and on-chip memory 4 for information about the four programmable chip selects available in expanded modes, refer to section 4.5. a security feature can protect eeprom data when in expanded mode (see section 4.6.3). 4.1.3 special test mode special test, a variation of the expanded mode, is used during motorolas internal production testing, and is not intended or recommended for any other purpose. its speci?ation is subject to change without notice. 4.1.4 special bootstrap mode when the mcu is reset in special bootstrap mode, a small on-chip rom is enabled at address $be40?bfff. the rom contains a reset vector and a bootloader program. the mcu fetches the reset vector, then executes the bootloader. for normal use of the bootloader program, send a synchronization byte $ff to the sci receiver at either e clock 256, or e clock 1664 (15624 or 2400 baud respectively, for an e clock of 4 mhz). then download up to 768 bytes of program data (which is put into ram starting at $00a0). these characters are echoed through the transmitter. the bootloader program ends the download after a timeout of four character times or 768 bytes. when loading is complete, the program jumps to location $00a0 and begins executing the code. use of an external pull-up resistor is required when using the sci transmitter pin (txd) because port d pins are con?ured for wired-or operation by the bootloader. in bootstrap mode, the interrupt vectors point to ram. this allows the use of interrupts through a jump table. further baud rate options are available on the MC68HC11KW1 by using a different value for the synchronization byte, as shown in table 4-1. refer also to motorola application note an1060, m68hc11 bootstrap mode (the bootloader mode is similar to that used on the mc68hc11k4). table 4-1 example bootloader baud rates sync. byte timeout delay baud rates for an e clock of 4.00mhz $ff 4 char. 15 624 $ff 4 2400 $f0 4.9 19200 $fd 17.3 10416 $fd 13 7812 tpg 44
MC68HC11KW1 motorola 4-3 operating modes and on-chip memory 4 4.2 on-chip memory the MC68HC11KW1 mcu includes 768 bytes of on-chip ram and 640 bytes of eeprom. the bootloader rom occupies a 448 byte block of the memory map. the config register is implemented as a separate eeprom byte. 4.2.1 mapping allocations memory locations for on-chip resources are the same for both expanded and single chip modes. the 160-byte register block originates at $0000 on reset and can be placed at any other 4k boundary ($x000) after reset by writing an appropriate value to the init register. refer to figure 4-1, which shows the memory map. the on-board 768 byte block of ram is initially located at $00a0 after reset. the ram is divided into two sections of 160 bytes and 608 bytes. if ram and registers are both mapped to the same 4k boundary, ram starts at $x0a0 and 160 bytes are remapped at $x300?x39f. otherwise, ram starts at $x000. see figure 4-2. remapping is accomplished by writing appropriate values into the two nibbles of the init register. see section 4.3.2.2. the 640-byte eeprom is initially located at $0d80 after reset, when eeprom is enabled in the memory map by the config register. eeprom can be placed in any other 4k page ($xd80) by writing to the init2 register. figure 4-1 MC68HC11KW1 memory map single chip expanded special bootstrap special test start address $0000 $00a0 $03a0 $0d80 $1000 $ffc0 ?ffff $be40 $c000 each of these blocks can be mapped to any 4k page boundary, using the init register. ? ? this block may be remapped to any 4k page, using init2. special bootstrap mode only. special modes only. normal mode v ectors. vectors vectors bootrom eeprom 640 bytes ram 768 bytes register block $x000 $x09f $x0a0 $x39f $xd80 $xfff $be40 $bfff $ffff $ffc0 tpg 45
motorola 4-4 MC68HC11KW1 operating modes and on-chip memory 4 in special bootstrap mode, a bootloader rom is enabled at locations $be40?bfff. the vectors for special bootstrap mode are contained in the bootloader program. 4.2.1.1 ram the MC68HC11KW1 has 768 bytes of fully static ram that are used for storing instructions, variables and temporary data during program execution. ram can be placed at any 4k boundary in the 64k byte address space by writing an appropriate value to the init register. by default, ram is initially located at $00a0 in the memory map. direct addressing mode can access the ?st 96 locations of ram using a one-byte address operand. direct mode accesses save program memory space and execution time. registers can be moved to other boundaries to allow 256 bytes of ram to be located in direct addressing space. see figure 4-2. the on-chip ram is a fully static memory. ram contents can be preserved during periods of processor inactivity by either of two methods, both of which reduce power consumption: 1) during the software-based stop mode, mcu clocks are stopped, but the mcu continues to draw power from v dd . power supply current is directly related to operating frequency in cmos integrated circuits and there is very little leakage when the clocks are stopped. these two factors reduce power consumption while the mcu is in stop mode. 2) to reduce power consumption to a minimum, v dd can be turned off, and the modb/vstby pin can be used to supply ram power from either a battery back-up or a second power supply. although this method requires external hardware, it is very effective. refer to section 2 for information about how to connect the stand-by ram power supply and to section 5 for a description of low power operation. 4.2.1.2 bootloader rom the bootloader rom is enabled at address $be40?bfff during special bootstrap mode. the reset vector is fetched from this rom and the mcu executes the bootloader ?mware. in normal modes, the bootloader rom is disabled. 4.2.2 registers in table 4-2, a summary of registers and control bits, the registers are shown in ascending order within the 160-byte register block. the addresses shown are for default block mapping ($0000?009f), however the init register remaps the block to any 4k page ($x000?x09f). see section 4.3.2.2. tpg 46
MC68HC11KW1 motorola 4-5 operating modes and on-chip memory 4 table 4-2 register and control bit assignments (page 1 of 5) register name address bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 state on reset port a data (porta) $0000 pa7 pa6 pa5 pa4 pa3 pa2 pa1 pa0 unde?ed data direction a (ddra) $0001 dda7 dda6 dda5 dda4 dda3 dda2 dda1 dda0 0000 0000 data direction b (ddrb) $0002 ddb7 ddb6 ddb5 ddb4 ddb3 ddb2 ddb1 ddb0 0000 0000 data direction f (ddrf) $0003 ddf7 ddf6 ddf5 ddf4 ddf3 ddf2 ddf1 ddf0 0000 0000 port b data (portb) $0004 pb7 pb6 pb5 pb4 pb3 pb2 pb1 pb0 unde?ed port f data (portf) $0005 pf7 pf6 pf5 pf4 pf3 pf2 pf1 pf0 unde?ed port c data (portc) $0006 pc7 pc6 pc5 pc4 pc3 pc2 pc1 pc0 unde?ed data direction c (ddrc) $0007 ddc7 ddc6 ddc5 ddc4 ddc3 ddc2 ddc1 ddc0 0000 0000 port d data (portd) $0008 pd7 pd6 pd5 pd4 pd3 pd2 pd1 pd0 unde?ed data direction d (ddrd) $0009 ddd7 ddd6 ddd5 ddd4 ddd3 ddd2 ddd1 ddd0 0000 0000 port e data (porte) $000a pe7 pe6 pe5 pe4 pe3 pe2 pe1 pe0 unde?ed timer compare force (cforc) $000b foc1 foc2 foc3 foc4 foc5 0 0 0 0000 0000 output compare 1 mask (oc1m) $000c oc1m7 oc1m6 oc1m5 oc1m4 oc1m3 0 0 0 0000 0000 output compare 1 data (oc1d) $000d oc1d7 oc1d6 oc1d5 oc1d4 oc1d3 0 0 0 0000 0000 timer count (tcnt) high $000e (bit 15) (14) (13) (12) (11) (10) (9) (bit 8) 0000 0000 timer count (tcnt) low $000f (bit 7) (6) (5) (4) (3) (2) (1) (bit 0) 0000 0000 timer input capture 1 (tic1) high $0010 (bit 15) (14) (13) (12) (11) (10) (9) (bit 8) unde?ed timer input capture 1 (tic1) low $0011 (bit 7) (6) (5) (4) (3) (2) (1) (bit 0) unde?ed timer input capture 2 (tic2) high $0012 (bit 15) (14) (13) (12) (11) (10) (9) (bit 8) unde?ed timer input capture 2 (tic2) low $0013 (bit 7) (6) (5) (4) (3) (2) (1) (bit 0) unde?ed timer input capture 3 (tic3) high $0014 (bit 15) (14) (13) (12) (11) (10) (9) (bit 8) unde?ed timer input capture 3 (tic3) low $0015 (bit 7) (6) (5) (4) (3) (2) (1) (bit 0) unde?ed timer output compare 1 (t oc1) high $0016 (bit 15) (14) (13) (12) (11) (10) (9) (bit 8) 1111 1111 timer output compare 1 (t oc1) low $0017 (bit 7) (6) (5) (4) (3) (2) (1) (bit 0) 1111 1111 timer output compare 2 (t oc2) high $0018 (bit 15) (14) (13) (12) (11) (10) (9) (bit 8) 1111 1111 timer output compare 2 (t oc2) low $0019 (bit 7) (6) (5) (4) (3) (2) (1) (bit 0) 1111 1111 timer output compare 3 (t oc3) high $001a (bit 15) (14) (13) (12) (11) (10) (9) (bit 8) 1111 1111 timer output compare 3 (t oc3) low $001b (bit 7) (6) (5) (4) (3) (2) (1) (bit 0) 1111 1111 timer output compare 4 (t oc4) high $001c (bit 15) (14) (13) (12) (11) (10) (9) (bit 8) 1111 1111 timer output compare 4 (t oc4) low $001d (bit 7) (6) (5) (4) (3) (2) (1) (bit 0) 1111 1111 capture 4/compare 5 (ti4/o5) high $001e (bit 15) (14) (13) (12) (11) (10) (9) (bit 8) 1111 1111 capture 4/compare 5 (ti4/o5) low $001f (bit 7) (6) (5) (4) (3) (2) (1) (bit 0) 1111 1111 timer control 1 (tctl1) $0020 om2 ol2 om3 ol3 om4 ol4 om5 ol5 0000 0000 timer control 2 (tctl2) $0021 edg4b edg4a edg1b edg1a edg2b edg2a edg3b edg3a 0000 0000 timer interr upt mask 1 (tmsk1) $0022 oc1i oc2i oc3i oc4i i4/o5i ic1i ic2i ic3i 0000 0000 tpg 47
motorola 4-6 MC68HC11KW1 operating modes and on-chip memory 4 timer interrupt ?g 1 (tflg1) $0023 oc1f oc2f oc3f oc4f i4/o5f ic1f ic2f ic3f 0000 0000 timer interr upt mask 2 (tmsk2) $0024 toi rtii paovi paii 0 0 pr1 pr0 0000 0000 timer interrupt ?g 2 (tflg2) $0025 tof rtif paovf paif 0000 0000 0000 pulse accum ulator control (pa ctl) $0026 0 paen p amodpedge 0 i4/o5 rtr1 rtr0 0000 0000 pulse accum ulator count (pa cnt) $0027 (bit 7) (6) (5) (4) (3) (2) (1) (bit 0) unde?ed spi control (spcr) $0028 spie spe dwom mstr cpol cpha spr1 spr0 0000 01uu spi status (spsr) $0029 spif wcol 0 modf 0000 0000 0000 spi data (spdr) $002a (bit 7) (6) (5) (4) (3) (2) (1) (bit 0) unde?ed reserved $002b port pull-up assignment (ppar) $002c 0000 hppue gppue fppue bppue 0000 1111 port g assignment (pgar) $002d 0 0 pgar5 pgar4 pgar3 pgar2 pgar1 pgar0 0000 0000 reserved $002e reserved $002f a/d control & status (adctl) $0030 ccf conv8 scan mult cd cc cb ca 0000 0000 compare f orce for timers 2 and 3 (f23frc) $0031 ft3c1 ft3c2 ft3c3 ft3c4 ft2c1 ft2c2 ft2c3 ft2c4 0000 0000 a/d frequency select (adfrq) $0032 0000000 ader 0000 0000 reserved $0033 reserved $0034 block protect (bprot) $0035 b ulkp bit6 bprt4 ptcon bprt3 bprt2 bprt1 bprt0 1111 1111 reserved $0036 eeprom mapping (init2) $0037 ee3 ee2 ee1 ee0 0000 0000 0000 system con?. options 2 (opt2) $0038 lirdv cwom 0 irvne lsbf spr2 xdv1 xdv0 000x 0000 system con?. options 1 (option) $0039 adpu csel irqe dly cme fcme cr1 cr0 0001 0000 cop timer arm/reset (coprst) $003a (bit 7) (6) (5) (4) (3) (2) (1) (bit 0) unde?ed eeprom programming (pprog) $003b odd even 0 byte row erase eelat eepg m 0000 0000 highest prior ity interr upt (hprio) $003c rboot smod mda psel4 psel3 psel2 psel1 psel0 xxx0 0110 ram & i/o mapping (init) $003d ram3 ram2 ram1 ram0 reg3 reg2 reg1 reg0 0000 0000 factory test (test1) $003e tilop 0 occr cbyp disr fcm fcop 0 0000 x000 con?ur ation control (config) $003f 1 1 clkx paren nosec noco p 1 eeon 11xx xx1x a/d result 1 (adr1) high $0040 (bit 15) (14) (13) (12) (11) (10) (9) (8) unde?ed a/d result 1 (a dr1) low $0041 (7) (6) 000000 uu00 0000 a/d result 2 (adr2) high $0042 (bit 15) (14) (13) (12) (11) (10) (9) (8) unde?ed a/d result 2 (adr2) low $0043 (7) (6) 000000 uu00 0000 table 4-2 register and control bit assignments (page 2 of 5) register name address bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 state on reset tpg 48
MC68HC11KW1 motorola 4-7 operating modes and on-chip memory 4 a/d result 3 (adr3) high $0044 (bit 15) (14) (13) (12) (11) (10) (9) (8) unde?ed a/d result 3 (adr3) low $0045 (7) (6) 000000 uu00 0000 a/d result 4 (adr4) high $0046 (bit 15) (14) (13) (12) (11) (10) (9) (8) unde?ed a/d result 4 (adr4) low $0047 (7) (6) 000000 uu00 0000 a/d result 5 (adr5) high $0048 (bit 15) (14) (13) (12) (11) (10) (9) (8) unde?ed a/d result 5 (adr5) low $0049 (7) (6) 000000 uu00 0000 a/d result 6 (adr6) high $004a (bit 15) (14) (13) (12) (11) (10) (9) (8) unde?ed a/d result 6 (adr6) low $004b (7) (6) 000000 uu00 0000 a/d result 7 (adr7) high $004c (bit 15) (14) (13) (12) (11) (10) (9) (8) unde?ed a/d result 7 (adr7) low $004d (7) (6) 000000 uu00 0000 a/d result 8 (adr8) high $004e (bit 15) (14) (13) (12) (11) (10) (9) (8) unde?ed a/d result 8 (adr8) low $004f (7) (6) 000000 uu00 0000 reserved $0050 reserved $0051 reserved $0052 reserved $0053 reserved $0054 reserved $0055 memory mapping window size (mmsiz) $0056 mxgs2 mxgs1 w2sz1 w2sz0 0 0 w1sz1 w1sz0 0000 0000 memory mapping window base (mmwbr) $0057 w2a15 w2a14 w2a13 0 w1a15 w1a14 w1a13 0 0000 0000 memory mapping window 1 control (mm1cr) $0058 0 x1a18 x1a17 x1a16 x1a15 x1a14 x1a13 0 0000 0000 memory mapping window 2 control (mm2cr) $0059 0 x2a18 x2a17 x2a16 x2a15 x2a14 x2a13 0 0000 0000 chip select clock stretch (cscstr) $005a iosa iosb gp1sa gp1sb gp2sa gp2sb pcsa pcsb 0000 000x chip select control (csctl) $005b ioen iopl iocsa iosz gcspr pcsen pcsza pcszb 0000 0100 gen. pur pose chip select 1 addr. (gpcs1a) $005c g1a18 g1a17 g1a16 g1a15 g1a14 g1a13 g1a12 g1a11 0000 0000 gen. pur pose chip select 1 con. (gpcs1c) $005d g1dg2 g1dpc g1pol g1av g1sza g1szb g1szc g1szd 0000 0000 gen. pur pose chip select 2 addr. (gpcs2a) $005e g2a18 g2a17 g2a16 g2a15 g2a14 g2a13 g2a12 g2a11 0000 0000 gen. pur pose chip select 2 con. (gpcs2c) $005f 0 g2dpc g2pol g2av g2sza g2szb g2szc g2szd 0000 0000 pulse width clock select (pwclk) $0060 con34 con12 pcka2 pcka1 0 pckb3 pckb2 pckb1 0000 0000 pulse width polarity select (pwpol) $0061 pclk4 pclk3 pclk2 pclk1 ppol4 ppol3 ppol2 ppol1 0000 0000 pulse width scale (pwscal) $0062 (bit 7) (6) (5) (4) (3) (2) (1) (bit 0) 0000 0000 pulse width enable (pwen) $0063 tpwsl discp 0 0 pwen4pwen3pwen2pwen1 0000 0000 pulse width count 1 (pwcnt1) $0064 (bit 7) (6) (5) (4) (3) (2) (1) (bit 0) 0000 0000 table 4-2 register and control bit assignments (page 3 of 5) register name address bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 state on reset tpg 49
motorola 4-8 MC68HC11KW1 operating modes and on-chip memory 4 pulse width count 2 (pwcnt2) $0065 (bit 7) (6) (5) (4) (3) (2) (1) (bit 0) 0000 0000 pulse width count 3 (pwcnt3) $0066 (bit 7) (6) (5) (4) (3) (2) (1) (bit 0) 0000 0000 pulse width count 4 (pwcnt4) $0067 (bit 7) (6) (5) (4) (3) (2) (1) (bit 0) 0000 0000 pulse width pe riod 1 (pwper1) $0068 (bit 7) (6) (5) (4) (3) (2) (1) (bit 0) 1111 1111 pulse width pe riod 2 (pwper2) $0069 (bit 7) (6) (5) (4) (3) (2) (1) (bit 0) 1111 1111 pulse width pe riod 3 (pwper3) $006a (bit 7) (6) (5) (4) (3) (2) (1) (bit 0) 1111 1111 pulse width pe riod 4 (pwper4) $006b (bit 7) (6) (5) (4) (3) (2) (1) (bit 0) 1111 1111 pulse width duty 1 (pwdty1) $006c (bit 7) (6) (5) (4) (3) (2) (1) (bit 0) 1111 1111 pulse width duty 2 (pwdty2) $006d (bit 7) (6) (5) (4) (3) (2) (1) (bit 0) 1111 1111 pulse width duty 3 (pwdty3) $006e (bit 7) (6) (5) (4) (3) (2) (1) (bit 0) 1111 1111 pulse width duty 4 (pwdty4) $006f (bit 7) (6) (5) (4) (3) (2) (1) (bit 0) 1111 1111 sci baud rate high (scbdh) $0070 btst bspl sync sbr12 sbr11 sbr10 sbr9 sbr8 0000 0000 sci baud r ate low (scbdl) $0071 sbr7 sbr6 sbr5 sbr4 sbr3 sbr2 sbr1 sbr0 0000 0100 sci control 1 (sccr1) $0072 loops woms 0 m wake ilt pe pt 0000 0000 sci control 2 (sccr2) $0073 tie tcie rie ilie te re rwu sbk 0000 0000 sci status 1 (scsr1) $0074 tdre tc rdrf idle or nf fe pf 1100 0000 sci status 2 (scsr2) $0075 0000000raf 0000 0000 sci data high (scdrh) $0076 r8 t8 000000 unde?ed sci data low (scdrl) $0077 r7t7 r6t6 r5t5 r4t4 r3t3 r2t2 r1t1 r0t0 unde?ed reserved $0078 reserved $0079 reserved $007a reserved $007b port h data (porth) $007c ph7 ph6 ph5 ph4 ph3 ph2 ph1 ph0 unde?ed data direction h (ddrh) $007d ddh7 ddh6 ddh5 ddh4 ddh3 ddh2 ddh1 ddh0 0000 0000 port g data (portg) $007e pg7 pg6 pg5 pg4 pg3 pg2 pg1 pg0 unde?ed data direction g (ddrg) $007f 0 0 ddg5 ddg4 ddg3 ddg2 ddg1 ddg0 0000 0000 timer control register 3 (tctl3) $0080 om1 ol1 om2 ol2 om3 ol3 om4 ol4 0000 0000 timer control register 4 (tctl4) $0081 edgb edga pr2b pr2a eceb ecea t2stp i1/04 0000 0000 timer 2 counter register (tcnt2) high $0082 (bit 15) (14) (13) (12) (11) (10) (9) (bit 8) 0000 0000 timer 2 counter register (tcnt2) low $0083 (bit 7) (6) (5) (4) (3) (2) (1) (bit 0) 0000 0000 timer 2 output compare 1(t2oc1) high $0084 (bit 15) (14) (13) (12) (11) (10) (9) (bit 8) 1111 1111 timer 2 output compare 1 (t2oc1) low $0085 (bit 7) (6) (5) (4) (3) (2) (1) (bit 0) 1111 1111 timer 2 output comp. 2 (t2oc2) high $0086 (bit 15) (14) (13) (12) (11) (10) (9) (bit 8) 1111 1111 table 4-2 register and control bit assignments (page 4 of 5) register name address bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 state on reset tpg 50
MC68HC11KW1 motorola 4-9 operating modes and on-chip memory 4 timer 2 output comp. 2 (t2oc2) low $0087 (bit 7) (6) (5) (4) (3) (2) (1) (bit 0) 1111 1111 timer 2 output comp. 3 (t20c3) high $0088 (bit 15) (14) (13) (12) (11) (10) (9) (bit 8) 1111 1111 timer 2 output comp. 3(t20c3) low $0089 (bit 7) (6) (5) (4) (3) (2) (1) (bit 0) 1111 1111 timer 2 channel 4 (t2c4) high $008a (bit 15) (14) (13) (12) (11) (10) (9) (bit 8) 1111 1111 timer 2 channel 4 (t2c4) low $008b (bit 7) (6) (5) (4) (3) (2) (1) (bit 0) 1111 1111 timer 2 mask (t2msk) $008c oc1i oc2i oc3i c4i to2i 0 0 0 0000 0000 timer 2 ?g (t2flg) $008d oc1f oc2f oc3f c4f to2f 0 0 0 0000 0000 port j data (portj) $008e pj7 pj6 pj5 pj4 pj3 pj2 pj1 pj0 unde?ed data direction j (ddrj) $008f ddj7 ddj6 ddj5 ddj4 ddj3 ddj2 ddj1 ddj0 0000 0000 timer control register 5 (tctl5) $0090 om1 ol1 om2 ol2 om3 ol3 om4 ol4 0000 0000 timer control register 6 (tctl6) $0091 edgb edga pr3b pr3a eceb ecea t3stp i1/o4 0000 0000 timer 3 counter (tcnt3) high $0092 (bit 15) (14) (13) (12) (11) (10) (9) (bit 8) 0000 0000 timer 3 counter (tcnt3) low $0093 (bit 7) (6) (5) (4) (3) (2) (1) (bit 0) 0000 0000 timer 3 output compare 1 (t30c1) high $0094 (bit 15) (14) (13) (12) (11) (10) (9) (bit 8) 1111 1111 timer 3 output compare 1 (t30c1) low $0095 (bit 7) (6) (5) (4) (3) (2) (1) (bit 0) 1111 1111 timer 3 output compare 2 (t30c2) high $0096 (bit 15) (14) (13) (12) (11) (10) (9) (bit 8) 1111 1111 timer 3 output compare 2 (t30c2) low $0097 (bit 7) (6) (5) (4) (3) (2) (1) (bit 0) 1111 1111 timer 3 output comp. 3 (t3oc3) high $0098 (bit 15) (14) (13) (12) (11) (10) (9) (bit 8) 1111 1111 timer 3 output comp. 3 (t3oc3) low $0099 (bit 7) (6) (5) (4) (3) (2) (1) (bit 0) 1111 1111 timer 3 channel 4 (t3c4) high $009a (bit 15) (14) (13) (12) (11) (10) (9) (bit 8) 1111 1111 timer 3 channel 4 (t3c4) low $009b (bit 7) (6) (5) (4) (3) (2) (1) (bit 0) 1111 1111 timer 3 mask (t3msk) $009c oc1i oc2i oc3i c4i to3i 0 0 0 0000 0000 timer 3 ?g (t3flg) $009d oc1f oc2f oc3f c4f to3f 0 0 0 0000 0000 port k data (portk) $009e pk7 pk6 pk5 pk4 pk3 pk2 pk1 pk0 unde?ed data direction k (ddrk) $009f ddk7 ddk6 ddk5 ddk4 ddk3 ddk2 ddk1 ddk0 0000 0000 table 4-2 register and control bit assignments (page 5 of 5) register name address bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 state on reset key x state on reset depends on mode selected u state of bit on reset is undef ined tpg 51
motorola 4-10 MC68HC11KW1 operating modes and on-chip memory 4 4.3 system initialization registers and bits that control initialization and the basic operation of the mcu are protected against writes except under special circumstances. the following table lists registers that can be written only once after reset, or that must be written within the ?st 64 cycles after reset. 4.3.1 mode selection the four mode variations are selected by the logic states of the mode a (moda) and mode b (modb) pins during reset. the moda and modb logic levels determine the logic state of the special mode (smod) and mode a (mda) control bits in the highest priority i-bit interrupt and miscellaneous (hprio) register. after reset is released, the mode select pins no longer in?ence the mcu operating mode. in single chip operating mode, moda pin is connected to a logic zero. in expanded mode, moda is normally connected to v dd through a pull-up resistor of 4.7 k w . the moda pin also functions as the load instruction register (lir ) pin when the mcu is not in reset. the open-drain active low lir output pin drives low during the ?st e cycle of each instruction. the modb pin also functions as the stand-by power input (vstby), which allows the ram contents to be maintained in the absence of v dd . table 4-3 registers with limited write access register address register name must be written in rst 64 cycles write once only $x024 timer interrupt mask register 2 (tmsk2) (1) (1) when smod = 0, bits 1 and 0 can be written only once, dur ing the ?st 64 cycles, after which they become read-only. when smod = 1, however, these bits can be written at any time. all other bits can be written at any time. $x035 block protect register (bprot) (2) (2) bits can be wr itten to z ero once and only in the ?st 64 cycles or in special modes. bits can be set to one at any time. $x037 eeprom mapping register (init2) no yes $x038 system con?u ration options register 2 (opt2) no (3) (3) bit 4 (ir vne) can be wr itten only once. $x039 system con?ur ation options register (option) (4) (4) when smod = 0, bits 5, 4, 2, 1, and 0 can be written once and only in the ?st 64 cycles. when smod = 1, however, bits 5, 4, 2, 1, and 0 can be written at any time. all other bits can be written at any time. $x03d ram and i/o map register (init) (5) (5) when smod = 0, bits can be wr itten only once, during the ?st 64 cycles, after which the register becomes read-only. when smod = 1, bits can be wr itten at any time. $x081 timer control register 4 (timer 2) tctl4 no (6) (6) bits 5, 4, 3 and 2 can be written only once. $x091 timer control register 6 (timer 3) tctl6 no (6) tpg 52
MC68HC11KW1 motorola 4-11 operating modes and on-chip memory 4 refer to table 4-4, which is a summary of mode pin operation, the mode control bits and the four operating modes. a normal mode is selected when modb is logic one during reset. one of three reset vectors is fetched from address $fffa?ffff, and program execution begins from the address indicated by this vector. if modb is logic zero during reset, the special mode reset vector is fetched from addresses $bffa?bfff and software has access to special test features. refer to section 5. 4.3.1.1 hprio ?highest priority i-bit interrupt & misc. register note: rboot, smod and mda bits depend on the power-up initialization mode and can only be written in special modes when smod = 1. refer to table 4-4. rboot ?read bootstrap rom 1 (set) bootloader rom enabled, at $be40?bfff. 0 (clear) bootloader rom disabled and not in map. smod ?special mode select 1 (set) special mode variation in effect. 0 (clear) normal mode variation in effect. once cleared, cannot be set again. mda ?mode select a 1 (set) normal expanded or special test mode. (expanded buses active.) 0 (clear) normal single chip or special bootstrap mode. (ports active.) psel[4:0] ?priority select bits (refer to section 5) address bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 state on reset highest prior ity interr upt (hprio) $003c rboot smod mda psel4 psel3 psel2 psel1 psel0 xxx0 0110 table 4-4 hardware mode select summary inputs mode cont rol bits in hprio (latched at reset) modb moda rboot smod mda 1 0 single chip 0 0 0 1 1 expanded 0 0 1 0 0 special bootstrap 1 1 0 0 1 special test 0 1 1 tpg 53
motorola 4-12 MC68HC11KW1 operating modes and on-chip memory 4 4.3.2 initialization because bits in the following registers control the basic con?uration of the mcu, an accidental change of their values could cause serious system problems. the protection mechanism, overridden in special operating modes, requires a write to the protected bits only within the ?st 64 bus cycles after any reset, or only once after each reset. see table 4-3. 4.3.2.1 config ?system con?uration register config controls the presence of eeprom in the memory map and enables the cop watchdog system. the clkx bit enables the xout pin to output the xclk signal, and the paren bit enables pull-ups on certain ports. refer to section 4.6.3. a security feature that protects data in eeprom and ram is available, controlled by the nosec bit (refer to section 4.6.3). config is made up of eeprom cells and static working latches. the operation of the mcu is controlled directly by these latches and not the eeprom byte. when programming the config register, the eeprom byte is accessed. when the config register is read, the static latches are accessed. these bits can be read at any time. the value read is the one latched into the register from the eeprom cells during the last reset sequence. a new value programmed into this register is not readable until after a subsequent reset sequence. bits in config can be written at any time if smod = 1 (bootstrap or special test mode). if smod = 0 (single chip or expanded mode), these bits can only be written using the eeprom programming sequence, and none of the bits are readable or active until latched via the next reset. bits [7, 6, 1] ?not implemented; always read as one. clkx ?xout enable 1 (set) xclk signal is driven out on the xout pin. 0 (clear) xout pin is disabled. the frequency of the xclk signal is controlled by two bits in the opt2 register (see section 4.3.2.5). paren ?pull-up assignment register enable (refer to section 6) 1 (set) pull-ups can be enabled using ppar. 0 (clear) all pull-ups disabled (not controlled by ppar). address bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 state on reset con?ur ation control (config) $003f 1 1 clkx paren nosec noco p 1 eeon 11xx xx1x tpg 54
MC68HC11KW1 motorola 4-13 operating modes and on-chip memory 4 nosec ?eeprom security disabled (refer to section 4.6.3) 1 (set) disable security. 0 (clear) enable security. nocop ?cop system disable (refer to section 5) 1 (set) cop system disabled. 0 (clear) cop system enabled (forces reset on timeout). eeon ?eeprom enable 1 (set) eeprom included in the memory map. 0 (clear) eeprom is excluded from the memory map. 4.3.2.2 init ?ram and i/o mapping register the internal registers used to control the operation of the mcu can be relocated on 4k boundaries within the memory space with the use of init. this 8-bit special-purpose register can change the default locations of the ram and control registers within the mcu memory map. it can be written to only once within the ?st 64 e clock cycles after a reset. it then becomes a read-only register. ram[3:0] ?ram map position these four bits, which specify the upper hexadecimal digit of the ram address, control the position of the ram in the memory map. the ram can be positioned at the beginning of any 4k page in the memory map. refer to table 4-5. reg[3:0] ?160-byte register block position these four bits specify the upper hexadecimal digit of the address for the 160-byte block of internal registers. the register block is positioned at the beginning of any 4k page in the memory map. refer to table 4-5. address bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 state on reset ram & i/o mapping (init) $003d ram3 ram2 ram1 ram0 reg3 reg2 reg1 reg0 0000 0000 tpg 55
motorola 4-14 MC68HC11KW1 operating modes and on-chip memory 4 when the memory map has the 160-byte register block mapped at the same location as ram, the registers have priority and the ram is relocated to the memory space immediately following the register block. this mapping feature keeps all the ram available for use. refer to figure 4-2, which illustrates the overlap. table 4-5 ram and register remapping ram[3:0] location reg[3:0] location 0000 $0000?02ff 0000 $0000?009f 0001 $1000?12ff 0001 $1000?109f 0010 $2000?22ff 0010 $2000?209f 0011 $3000?32ff 0011 $3000?309f 0100 $4000?42ff 0100 $4000?409f 0101 $5000?52ff 0101 $5000?509f 0110 $6000?62ff 0110 $6000?609f 0111 $7000?72ff 0111 $7000?709f 1000 $8000?82ff 1000 $8000?809f 1001 $9000?92ff 1001 $9000?909f 1010 $a000?a2ff 1010 $a000?a09f 1011 $b000?b2ff 1011 $b000?b09f 1100 $c000?c2ff 1100 $c000?c09f 1101 $d000?d2ff 1101 $d000?d09f 1110 $e000?e2ff 1110 $e000?e09f 1111 $f000?f2ff 1111 $f000?f09f figure 4-2 ram and register overlap $x000 $x09f $x0a0 $x2ff $x300 $x39f ram b ram a register block $x000 $x09f $x0a0 $x2ff ram b ram a register and ram mapped to diff erent 4k boundaries. register and ram mapped to the same 4k boundary. tpg 56
MC68HC11KW1 motorola 4-15 operating modes and on-chip memory 4 4.3.2.3 init2 ?eeprom mapping register this register determines the location of eeprom in the memory map. init2 may be read at any time but bits 7? may be written only once after reset in normal modes. ee[3:0] ?eeprom map position eeprom is located at $xd80?xfff, where x is the hexadecimal digit represented by ee[3:0]. refer to table 4-6. bits [3:0] ?not implemented; always read zero. 4.3.2.4 option ?system con?uration options register 1 the 8-bit special-purpose option register sets internal system con?uration options during initialization. the time protected control bits irqe, dly, fcme and cr[1:0] can be written only once in the ?st 64 cycles after a reset and then they become read-only bits. this minimizes the possibility of any accidental changes to the system con?uration. they may be written at any time in special modes. address bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 state on reset eeprom mapping (init2) $0037 ee3 ee2 ee1 ee0 0000 0000 0000 table 4-6 eeprom remapping ee[3:0] location ee[3:0] location ee[3:0] location ee[3:0] location 0000 $0d80?0fff 0100 $4d80?4fff 1000 $8d80?8fff 1100 $cd80?cff f 0001 $1d80?1fff 0101 $5d80?5fff 1001 $9d80?9fff 1101 $dd80?dff f 0010 $2d80?2fff 0110 $6d80?6fff 1010 $ad80?aff f 1110 $ed80?eff f 0011 $3d80?3fff 0111 $7d80?7fff 1011 $bd80?bff f 1111 $fd80?ffff address bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 state on reset system con?. options 1 (option) $0039 adpu csel irqe dly cme fcme cr1 cr0 0001 0000 tpg 57
motorola 4-16 MC68HC11KW1 operating modes and on-chip memory 4 adpu ?a/d power-up (refer to section 10) 1 (set) a/d system power enabled. 0 (clear) a/d system disabled, to reduce supply current. after enabling the a/d power, at least 100? should be allowed for system stabilization. csel ?clock select (refer to section 10) 1 (set) a/d and eeprom use internal rc clock source (about 1.5mhz). 0 (clear) a/d and eeprom use system e clock (must be at least 1mhz). this bit selects the clock source for the on-chip eeprom and a/d charge pumps. the on-chip rc clock should be used when the e clock frequency falls below 1mhz. irqe ?con?ure irq for falling-edge-sensitive operation 1 (set) falling-edge-sensitive operation. 0 (clear) low-level-sensitive operation. dly ?enable oscillator start-up delay 1 (set) a stabilization delay of around 4064 bus cycles is imposed as the mcu is started up from stop mode (or power-on reset). 0 (clear) the oscillator start-up delay is bypassed and the mcu resumes processing within about four bus cycles. a stable external oscillator is required if this option is selected. dly is set on reset, so a delay is always imposed as the mcu is started up from power-on reset. cme ?clock monitor enable (refer to section 5) 1 (set) clock monitor enabled. 0 (clear) clock monitor disabled. in order to use both stop and clock monitor, the cme bit should be cleared before executing stop, then set after recovering from stop. fcme ?force clock monitor enable (refer to section 5) 1 (set) clock monitor enabled; cannot be disabled until next reset. 0 (clear) clock monitor follows the state of the cme bit. when fcme is set, slow or stopped clocks will cause a clock failure reset sequence. to utilize stop mode, fcme should always be cleared. tpg 58
MC68HC11KW1 motorola 4-17 operating modes and on-chip memory 4 cr[1:0] ?cop timer rate select bits (refer to section 5) these control bits determine a scaling factor for the watchdog timer. 4.3.2.5 opt2 ?system con?uration options register 2 lirdv ?lir driven 1 (set) enable lir drive high pulse. 0 (clear) lir not driven high on moda/lir pin. in single-chip and bootstrap modes, this bit has no meaning or effect. the lir pin is driven low to indicate that execution of an instruction has begun. the lir pin is normally con?ured for wired-or operation (only pulls low). in order to detect consecutive instructions in a high-speed application, this signal can be made to drive high for a quarter of a cycle to prevent false triggering (lirdv set). cwom ?port c wired-or mode (refer to section 6) 1 (set) port c outputs are open-drain. 0 (clear) port c operates normally. bits [5, 0] ?not implemented; always read zero. irvne ?internal read visibility/not e irvne may be written once in normal modes, and can be written as often as desired in bootstrap and special test modes. in special test modes, irvne is reset to one. in normal and bootstrap modes, irvne is reset to zero. irvne should only be used at room temperature and 5v nominal. in expanded modes , irvne determines whether internal read visibility (irv) is on or off. 1 (set) data from internal reads is driven out of the external data bus. 0 (clear) no visibility of internal reads on external bus. in single chip modes this bit determines whether the e clock drives out from the chip. 1 (set) e pin is driven low. 0 (clear) e clock is driven out from the chip. refer to the following table for a summary of the operation immediately following reset. address bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 state on reset system con?. options 2 (opt2) $0038 lirdv cwom 0 irvne lsbf spr2 xdv1 xdv2 000x 0000 tpg 59
motorola 4-18 MC68HC11KW1 operating modes and on-chip memory 4 lsbf ?lsb-?st enable (refer to section 8) 1 (set) data is transferred lsb ?st. 0 (clear) data is transferred msb ?st. spr2 ?spi clock rate select (refer to section 8) this bit adds a divide-by-four to the spi clock chain. xdv[1, 0] ?xout clock divide select these two bits control the frequency of the xclk signal, which is output on the xout pin if enabled by the clkx bit in config. table 4-7 shows some example frequencies. once a clock rate has been selected, a maximum time of 16 e clock cycles should be allowed for the signal to stabilize. note that on reset, both bits are cleared and the xclk signal runs at the same frequency as extal. note: the phase relationship between xout and extal or e cannot be predicted. 4.3.2.6 bprot ?block protect register bprot prevents accidental writes to eeprom and the config register, and enables the low voltage eeprom protect circuit. the bits in this register can be written to zero only once during mode irvne after reset e clock after reset irv after reset irvne affects only irvne can be written single chip 0 on off e once expanded 0 on off irv once boot 0 on off e unlimited special test 1 on on irv unlimited table 4-7 xclk frequencies xdv 1 xdv2 extal divided by xclk with extal = 16 mhz 0 0 1 16 mhz 0 1 4 4 mhz 1 0 6 2.7 mhz 1 1 8 2 mhz address bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 state on reset block protect (bprot) $0035 b ulkp bit6 bprt4 ptcon bprt3 bprt2 bprt1 bprt0 1111 1111 tpg 60
MC68HC11KW1 motorola 4-19 operating modes and on-chip memory 4 the ?st 64 e clock cycles after reset in the normal modes; they can be set at any time. once the bits are cleared, the eeprom array and the config register can be programmed or erased. setting the bits in the bprot register to logic one protects the eeprom and config register until the next reset. refer to table 4-8. bulkp ?bulk erase of eeprom protect 1 (set) eeprom cannot be bulk or row erased. 0 (clear) eeprom can be bulk erased normally. bit6 bit6 can be programmed to 0 in the ?st 64 cycles, although the bit has no meaning. ptcon ?protect for config register 1 (set) config register cannot be programmed or erased. 0 (clear) config register can be programmed or erased normally. note that, in special modes, config may be written regardless of the state of ptcon. bprt[4:0] ?block protect bits for eeprom 1 (set) protection is enabled for associated block; it cannot be programmed or erased. 0 (clear) protection disabled for associated block. each of these ?e bits protects a block of eeprom against writing or erasure, as follows: table 4-8 eeprom block protect bit name block protected block size bprt0 $xd80?xd9f 32 b ytes bprt1 $xda0?xddf 64 b ytes bprt2 $xde0?xe5f 128 bytes bprt3 $xe60?xf7f 288 bytes bprt4 $xf80?xfff 128 bytes tpg 61
motorola 4-20 MC68HC11KW1 operating modes and on-chip memory 4 4.3.2.7 tmsk2 ?timer interrupt mask register 2 pr[1:0] are time-protected control bits and can be changed only once and then only within the ?st 64 bus cycles after reset in normal modes. note: bits [7:4] in tmsk2 correspond bit for bit with the ?g bits in tflg2. ones in bits [7:4] of tmsk2 enable the corresponding interrupt sources. toi ?timer over?w interrupt enable (refer to section 9) 1 (set) interrupt requested when tof is set. 0 (clear) tof interrupts disabled. rtii ?real-time interrupt enable (refer to section 9) 1 (set) interrupt requested when rtif set. 0 (clear) rtif interrupts disabled. paovi ?pulse accumulator over?w interrupt enable (refer to section 9) 1 (set) intdrrupt requested when paovf set. 0 (clear) paovf interrupts disabled. paii ?pulse accumulator interrupt enable (refer to section 9) 1 (set) interrupt requested when paif set. 0 (clear) paif interrupts disabled. bits [3, 2] ?not implemented; always read zero. pr[1:0] ?timer prescaler select these two bits select the prescale rate for the main 16-bit free-running timer system, timer 1. these bits can be written only once during the ?st 64 e clock cycles after reset in normal modes, or at any time in special modes. refer to the following table: address bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 state on reset timer interr upt mask 2 (tmsk2) $0024 toi rtii paovi paii 0 0 pr1 pr0 0000 0000 pr[1:0] prescale factor 0 0 1 0 1 4 1 0 8 1 1 16 tpg 62
MC68HC11KW1 motorola 4-21 operating modes and on-chip memory 4 4.3.2.8 tctl4 and tctl6 ?timer 2 and 3 control registers bits [5:2] in both these registers can be written only once after reset. the following paragraphs describe the timer 2 control bits in tctl4; the timer 3 control bits in tctl6 are described in section 9. edgb and edga ?input capture edge control (refer to section 9) this pair of bits con?ures the input capture edge detector circuits for ic1. ic1 functions only if the i1/o4 bit is set. pr2a and pr2b ?timer 2 prescaler select these bits are used to select the prescaler divide-by ratio for timer 2. they can be written to only once after reset. pr3a and pr3b ?timer 3 prescaler select these bits are used to select the prescaler divide-by ratio for timer 3. they can only be written to once after reset. if pr3b and pr3a are both cleared, then timer 3 is synchronized to the prescaled timer 1 rate. address bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 state on reset timer control register 4 (tctl4) $0081 edgb edga pr2b pr2a eceb ecea t2stp i1/04 0000 0000 address bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 state on reset timer control register 6 (tctl6) $0091 edgb edga pr3b pr3a eceb ecea t3stp i1/04 0000 0000 pr2b pr2a prescaler 0 0 1 0 1 4 1 0 8 1 1 16 pr3b pr3a prescaler 0 0 use timer 1 rate 0 1 1 1 0 4 1 1 16 tpg 63
motorola 4-22 MC68HC11KW1 operating modes and on-chip memory 4 eceb and ecea ?event counter edge control these control bits con?ure the input clock source for the timer 2 counter. they can be written to only once after reset. t2stp ?stop timer 2 counter (refer to section 9) 1 (set) timer 2 counter and prescaler are stopped and the counter is reset to $0000. 0 (clear) timer 2 counter operates normally. i1/o4 ?input capture 1/output compare 4 (refer to section 9) 1 (set) input capture 1 function is enabled (no oc4). 0 (clear) output compare 4 function is enabled (no ic1). 4.4 memory expansion 4.4.1 memory expansion logic the MC68HC11KW1 has the ability to extend the address range of the m68hc11 cpu beyond the physical 64k byte limit of the 16 cpu address lines. the extra addressing capability is provided by a register-based paging scheme using expansion address lines and the physical 64k bytes of cpu address space. two additional on-chip blocks are provided with the MC68HC11KW1. the ?st block implements additional address lines that become active only when required by the cpu. the second block provides chip-select signals that simplify the interface to external peripheral devices. both of these blocks are fully programmable by values written to associated control registers. eceb ecea con guration 0 0 timer 2 uses internal clock and prescaler 0 1 count on rising edges of external clock only 1 0 count on falling edges of external clock only 1 1 count on any edge of e xternal clock tpg 64
MC68HC11KW1 motorola 4-23 operating modes and on-chip memory 4 4.4.2 extended addressing memory expansion is achieved by manipulating the cpu address lines such that, even though the cpu cannot distinguish more than 64k bytes of physical memory, up to 1m byte can be accessed through a paged memory scheme. additional address lines xa[18:13] are provided as alternative functions of port g pins. bits in the port g assignment register (pgar) de?e which port g pins are to be used for memory expansion address lines and which are to be used for general-purpose i/o. in order to access expanded memory, the user must ?st allocate a range of the 64k byte address space to be used for the window(s) through which external, expanded memory is viewed by the cpu. the size and placement of the window(s) depend on values written to the mmsiz and mmwbr registers, respectively. which bank or page of the expanded memory that is present in the window(s) at a given time is dependent on values written to the mm1cr and mm2cr registers. up to two windows can be designated and each can be programmed to 0k (disabled), 8k, 16k, or 32k bytes. the base address for each window must be an integer multiple of the window size, with the exception of the 32k byte window, for which the base address can be at $0000, $4000, or $8000. if the windows are de?ed in such a way that they overlap, bank window 1 has priority and the part of window 2 that is not overlapped by bank window 1 remains active. if a window is de?ed such that it overlaps any internal registers, ram, or eeprom, then the portion of the registers, ram, or eeprom that is overlapped is repeated in all banks associated with that window. coming out of reset, the reset vector is fetched from external memory. since the memory expansion lines are disabled coming out of reset and can be internally pulled to logic level one, any external system that uses these expansion address lines sees them as all ones. in this case, the reset vector is fetched from $7fffe?7ffff. systems using external but not expanded memory still fetch the reset vector from $fffe?ffff. this is the reset vector's normal position at the top of the m68hc11 cpu's conventional 64k byte address space. expanded memory is addressed by using a combination of the cpu's normal address lines addr[15:0] and the expansion address lines xa[18:13]. window size and the number of banks associated with the window determine exactly which address lines are used. the additional address lines (xa[18:13]) determine which bank is present in a window at a given time. the lower three expansion address lines (xa[15:13]) are used only when needed by the cpu and replace the cpu's equivalent address lines (addr[15:13]). table 4-9 shows which address lines are used for various con?urations of expanded memory. a special case exists when the bank size is 32k bytes and the window base address is $4000. normally, when the bank size is 32k bytes and the bank address is $0000 or $8000, cpu address lines addr[14:0] select individual bytes within the 32k byte space and the addr[14:0] pins are connected to address lines (a[14:0]) of the memory device. when the base address is $4000, the cpu address signal addr14 must be inverted to allow 32k bytes of contiguous memory. the MC68HC11KW1 cpu drives the inverted cpu addr14 signal onto the xa14 pin when the window is active. in this case, the xa14 signal must be connected to the address line 14 of the memory device. when the window is not active, the xa14 pin is driven with the non-inverted cpu addr14 signal. tpg 65
motorola 4-24 MC68HC11KW1 operating modes and on-chip memory 4 if neither bank uses a particular expansion address bit, the corresponding pin is available for general-purpose i/o. the pgar register selects which pins are used for i/o or memory expansion address lines. 4.4.3 memory expansion examples consider an example system in which an external memory is used and the user wishes to allocate a single 8k byte window through which to access a total of 64k bytes of external memory. to provide the 8k byte address range needed for the window, only cpu address lines addr[12:0] need be used to provide 8k bytes (2 13 ) address locations. expansion address lines xa[15:13] replace cpu address lines addr[15:13] and provide an additional eight times (2 3 ) the number of address locations provided by addr[12:0], (a total of 64k bytes of address space). addr[12:0] provide the 8k byte window and xa[15:13] provide an additional eight bank-select signals that determine which bank is present in the window. this is illustrated infigure 4-3 and figure 4-4. figure 4-3 shows a memory map and figure 4-4 shows a schematic for a single 8k byte window with 8 banks of external memory . table 4-9 cpu address and address expansion signals number of banks window size 8k bytes 16k bytes 32k bytes 32k bytes (window based at $4000) 2 addr[12:0] addr[13:0] addr[14:0] addr[13:0] xa13 xa14 xa15 xa[15:14] 4 addr[12:0] addr[13:0] addr[14:0] addr[13:0] xa[14:13] xa[15:14] xa[16:15] xa[16:14] 8 addr[12:0] addr[13:0] addr[14:0] addr[13:0] xa[15:13] xa[16:14] xa[17:15] xa[17:14] 16 addr[12:0] addr[13:0] addr[14:0] addr[13:0] xa[16:13] xa[17:14] xa[18:15] xa[18:14] 32 addr[12:0] addr[13:0] xa[17:13] xa[18:14] 64 addr[12:0] xa[18:13] tpg 66
MC68HC11KW1 motorola 4-25 operating modes and on-chip memory 4 figure 4-3 memory map example of memory expansion $00000 $02000 $04000 $06000 $08000 $0a000 $0c000 $0e000 $01fff $03fff $05fff $07fff $09fff $0bfff $0dfff $0ffff bank 0 bank 1 bank 2 bank 3 bank 4 bank 5 bank 6 bank 7 xa[15:13] = 0:0:0 xa[15:13] = 0:0:1 xa[15:13] = 0:1:0 xa[15:13] = 0:1:1 xa[15:13] = 1:0:0 xa[15:13] = 1:0:1 xa[15:13] = 1:1:0 xa[15:13] = 1:1:1 window 1 chip select 1 $4000 $6000 $0000 pgar = $07 mmwbr = $04 mmsiz = $42 csctl = $00 gpcs1a = $00 gpsc1c = $06 gpcs2a = $00 gpcs2c = $00 xa[15:13] window 1 @ $4000, window 2 disabled window 1 = 8k b ytes, window 2 disabled no i/o or program chip selects general purpose chip select 1 from $00000 64k b yte r ange (8 x 8k) n/a general pur pose chip select 2 disabled registers, ram and eeprom $1000 $ffff $ffc0 vectors tpg 67
motorola 4-26 MC68HC11KW1 operating modes and on-chip memory 4 figure 4-4 schematic example of memory expansion a15 a14 a13 a12 a11 a10 a9 a8 a7 a5 a4 a3 a2 a1 a0 a6 addr0 addr12 addr11 addr10 addr9 addr8 addr7 addr6 addr5 addr4 addr3 addr2 addr1 xa15 xa14 xa13 addr0 addr12 addr11 addr10 addr9 addr8 addr7 addr6 addr5 addr4 addr3 addr2 addr1 data7 data6 data5 data4 data3 data2 data1 addr15 addr14 addr13 xa18 xa17 xa16 xa15 xa14 xa13 r/w e csgp2 csgp1 vcc oe ce vss d7 d6 d5 d4 d3 d2 d1 d0 v dd MC68HC11KW1 27c512 data0 data7 data6 data5 data4 data3 data2 data1 data0 tpg 68
MC68HC11KW1 motorola 4-27 operating modes and on-chip memory 4 in another example the user wishes to allocate two windows. the ?st window is organized as in the previous example, 8 banks of 8k bytes each. the second window is organized as 16 banks of 16k bytes each. the logical addresses in window 2 are determined by cpu address lines addr[13:0]. note that xa13 replaces addr13 for each memory device in this example since addr13 is driven on xa13. expansion address lines xa[17:14] add another 16 (2 4 ) times the number of address locations provided by addr[13:0] (256k bytes total address space). addr13 may also be used instead of xa13 for the 6226 memory devices if the designer chooses. this is illustrated in figure 4-3 and figure 4-6. figure 4-3 shows a memory map and figure 4-6 shows a schematic for one 8k byte window with 8 banks of external memory, and one 16k byte window with 16 banks of external memory . figure 4-5 memory map example of memory expansion $00000 $02000 $04000 $06000 $08000 $0a000 $0c000 $0e000 $01fff $03fff $05fff $07fff $09fff $0bfff $0dfff $0ffff bank 0 bank 1 bank 2 bank 3 bank 4 bank 5 bank 6 bank 7 xa[15:13] = 0:0:0 xa[15:13] = 0:0:1 xa[15:13] = 0:1:0 xa[15:13] = 0:1:1 xa[15:13] = 1:0:0 xa[15:13] = 1:0:1 xa[15:13] = 1:1:0 xa[15:13] = 1:1:1 window 1 chip select 1 $4000 $6000 $0000 pgar = $1f mmwbr = $84 mmsiz = $42 csctl = $00 gpcs1a = $00 gpsc1c = $06 gpcs2a = $00 gpcs2c = $08 xa[17:13] window 1 @ $4000, window 2 @ $8000 window 1 = 8k b ytes, window 2 = 16k b ytes no i/o or program chip selects general purpose chip select 1 from $00000 64k b yte r ange (8 x 8k) 256k b yte r ange (16 x 16k) $00000 $04000 $08000 $0c000 $10000 $3c000 $03fff $07fff $0bfff $0ffff $13fff $3ffff bank 0 bank 1 bank 2 bank 3 bank 4 bank15 xa[15:13] = 0:0:0:0 xa[15:13] = 0:0:0:1 xa[15:13] = 0:0:1:0 xa[15:13] = 0:0:1:1 xa[15:13] = 0:1:0:0 xa[15:13] = 1:1:1:1 chip select 2 window 2 general purpose chip select 2 from $00000 $8000 $c000 registers, ram and eeprom vectors $ffc0 $ffff tpg 69
motorola 4-28 MC68HC11KW1 operating modes and on-chip memory 4 figure 4-6 schematic example of memory expansion addr12 addr11 addr10 addr9 addr8 addr7 addr6 addr5 addr4 addr3 addr2 addr1 xa15 xa14 xa13 a15 a14 a13 a12 a10 a10 a9 a8 a7 a6 a5 a4 a3 a2 a1 a0 d7 d6 d5 d4 d3 d2 d1 d0 data7 data6 data5 data4 data3 data2 data1 data0 addr0 addr12 addr11 addr10 addr9 addr8 addr7 addr6 addr5 addr4 addr3 addr2 addr1 addr0 addr12 addr11 addr10 addr9 addr8 addr7 addr6 addr5 addr4 addr3 addr2 addr1 addr0 addr13 xa13 addr14 addr15 xa14 xa15 xa16 xa17 xa18 data7 data6 data5 data4 data3 data2 data1 data0 data7 data6 data5 data4 data3 data2 data1 data0 xa13 xa14 xa15 xa16 xa17 addr12 addr11 addr10 addr9 addr8 addr7 addr6 addr5 addr4 addr3 addr2 addr1 xa15 xa14 xa13 a15 a14 a13 a12 a10 a10 a9 a8 a7 a6 a5 a4 a3 a2 a1 a0 d7 d6 d5 d4 d3 d2 d1 d0 addr0 data7 data6 data5 data4 data3 data2 data1 data0 addr12 addr11 addr10 addr9 addr8 addr7 addr6 addr5 addr4 addr3 addr2 addr1 xa15 xa14 xa13 a15 a14 a13 a12 a10 a10 a9 a8 a7 a6 a5 a4 a3 a2 a1 a0 d7 d6 d5 d4 d3 d2 d1 d0 addr0 data7 data6 data5 data4 data3 data2 data1 data0 a16 e2 xa16 xa17 xa16 a16 MC68HC11KW1 27c512 6226 (high) (low) 6226 e2 oe w e1 v ss nc v cc v dd v cc oe w v ss nc e1 v dd xa17 v cc oe ce v dd csgp1 csgp2 e r/w tpg 70
MC68HC11KW1 motorola 4-29 operating modes and on-chip memory 4 4.4.4 mmsiz ?memory mapping window size register the mmsiz register sets the size of the windows in use and selects whether the on-board general-purpose chip selects are active for cpu addresses or for expansion addresses. mxgs[2:1] ?memory expansion select for general-purpose chip select 2 or 1 1 (set) general-purpose chip select 2 or 1 based on expansion address. 0 (clear) general-purpose chip select 2 or 1 based on 64k byte cpu address. w2sz[1:0] ?window 2 size these bits select the bank size for window 2. the window starting address depends on the contents of the mmwbr register and continues for the same number of bytes as the selected window size. refer to table 4-10. bits 3 and 2 ?not implemented; always read zero. w1sz[1:0] ?window 1 size these bits select the bank size for window 1. the window starting address depends on the contents of the mmwbr register and continues for the same number of bytes as the selected window size. refer to table 4-10. address bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 state on reset memory mapping window size (mmsiz) $0056 mxgs2 mxgs1 w2sz1 w2sz0 0 0 w1sz1 w1sz0 0000 0000 table 4-10 window size select wxsz[1:0] window size 0 0 window disabled 0 1 8k ?window can have up to 64 8k byte banks 1 0 16k ?window can have up to 32 16k byte banks 1 1 32k ?window can have up to 16 32k byte banks tpg 71
motorola 4-30 MC68HC11KW1 operating modes and on-chip memory 4 4.4.5 mmwbr ?memory mapping window base register the mmwbr register de?es the starting address of each of the two windows within the cpu 64k byte address range. the windows normally begin at a boundary related to their size (an 8k byte window can begin on any 8k byte boundary, beginning at $0000). w2a[15:13] ?window 2 base address these bits select the three most signi?ant bits (msb) of the base address for memory mapping window 2. note that w2a13 is ignored if the bank size is set for 16 or 32k bytes. refer to figure 4-11. bits 4 and 0 ?not implemented; always read zero. w1a[15:13] ?window base 1 address these bits select the three msbs of the base address for memory mapping window 1. note that w1a13 is ignored if the bank size is set for 16 or 32k bytes. refer to table 4-11. address bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 state on reset memory mapping window base (mmsiz) $0057 w2a15 w2a14 w2a13 0 w1a15 w1a14 w1a13 0 0000 0000 table 4-11 memory expansion window base address msb bits window base address wxa[15:13] 8k bytes 16k bytes 32k bytes 0 0 0 $0000 $0000 $0000 0 0 1 $2000 $0000 $0000 0 1 0 $4000 $4000 $4000 0 1 1 $6000 $4000 $4000 1 0 0 $8000 $8000 $8000 1 0 1 $a000 $8000 $8000 1 1 0 $c000 $c000 $8000 1 1 1 $e000 $c000 $8000 tpg 72
MC68HC11KW1 motorola 4-31 operating modes and on-chip memory 4 4.4.6 mm1cr, mm2cr ?memory mapping window 1 and 2 control registers these two window registers indicate which bank of a window is active. each contains the value to be output when the cpu selects addresses within the extended memory window. to change banks, write the address of the new bank into the appropriate window register. bits 7 and 0 ?not implemented; always read zero. mm1cr ?memory mapping window 1 control register when a 64k byte cpu address falls within window 1, the value in mm1cr is driven out from the corresponding expansion address lines to enable the speci?d bank in the window. mm2cr ?memory mapping window 2 control register when a 64k byte cpu address falls within window 2, the value in mm2cr is driven out from the corresponding expansion address lines to enable the speci?d bank in the window. overlap guidelines: on-chip registers, ram, and eeprom have higher priority than expansion windows. if a window overlaps ram, registers or eeprom, they appear in all banks at their cpu address. window 1 has a higher priority than window 2, therefore any overlapped portion of window 2 is inaccessible. address bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 state on reset memory mapping window 1 control (mm1cr) $0058 0 x1a18 x1a17 x1a16 x1a15 x1a14 x1a13 0 0000 0000 address bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 state on reset memory mapping window 2 control (mm2cr) $0059 0 x2a18 x2a17 x2a16 x2a15 x2a14 x2a13 0 0000 0000 tpg 73
motorola 4-32 MC68HC11KW1 operating modes and on-chip memory 4 4.4.7 pgar ?port g assignment register pgar selects which pins are used for i/o or memory expansion address lines, de?ing which extended address lines are used. the memory expansion address lines are shared with port g i/o pins. selecting an address on one of these pins causes a port g pin to be lost. therefore, to allow unused lines to serve as general-purpose i/o, select only those address lines that are needed by the expansion logic. if neither bank uses a particular expansion address bit, the corresponding pin is available for general-purpose i/o. if an address line is not required, clear the appropriate bit in pgar. (a special case exists for the address lines that overlap the cpu address lines xa[15:13]. if these lines are selected as address lines in pgar, but are not used in either window, the corresponding cpu address line is output on the appropriate port g pin.) bits [7:6] ?not implemented; always read zero. pgar[5:0] ?port g pin assignment 1 (set) corresponding port g pin is expansion address line (xa[18:13]). 0 (clear) corresponding port g pin is general-purpose i/o. 4.5 chip selects the function of the chip selects is to minimize the amount of external glue logic needed to interface the mcu to external devices. such factors as polarity, address block size, and clock stretching can be controlled using the chip-select registers. when enabled, a chip select signal is asserted whenever the cpu makes an access to a designated range of addresses. bus control signals and chip select signals are synchronous with the external e clock signal. refer to the section on expansion bus timing (section a.5.4) in the electrical speci?ations chapter. the length of the external e clock cycle to which the external device is synchronized can be stretched to accommodate devices that are slower than the mcu. there are six chip select control registers. chip select functions are enabled by control bits in the csctl register. when an mcu pin is not used for chip select functions, it can be used for general-purpose i/o. the MC68HC11KW1 has four software con?ured chip selects that are enabled in expanded modes. the chip select for i/o (csio) is used for i/o expansion. the program chip select (cspr og ) is used with an external memory that contains the reset vectors and program. the two general-purpose chip selects, csgp1 and csgp2, are used to enable external devices. these external devices can be in the 64k byte memory space or in the expanded memory space. address bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 state on reset port g assignment (pgar) $002d 0 0 pgar5 pagr4 pgar3 pgar2 pgar1 pgar0 0000 0000 tpg 74
MC68HC11KW1 motorola 4-33 operating modes and on-chip memory 4 4.5.1 chip select priorities to minimize con?ct between chip selects with one another or with internal memory and registers, priority is determined by the gpspr bit in the csctl register. refer to figure 4-12. 4.5.2 program chip select the program chip select (cspr og ) is active in the range of memory where the main program exists. other chip selects are active when their respective memory areas are used. refer to table 4-13. cspr og is enabled out of reset for normal expanded mode when there is no internal memory at the reset vector address $fffe?ffff. after reset in normal mode, the pcs stretch select bit in the cscstr register is set to provide one cycle of stretch so that slow memory devices can be used. in special test mode cspr og is enabled without any stretch out of reset. program chip select is ?ed with address valid timing and is active low. 4.5.3 i/o chip select the i/o chip select (csio) is programmable for a 4k byte size located at addresses $1000 to $1fff, or 8k byte size located at addresses $0000 to $1fff. polarity of the active state is programmable for active high or active low. clock stretching can be set from zero to three cycles. refer to section 4.5.4 for descriptions of bits ioen, iopl, iocsa, and iosz. table 4-12 chip select priorities gcspr = 0 gcspr = 1 on-chip registers on-chip registers on-chip ram on-chip ram bootloader rom bootloader rom on-chip eeprom on-chip eeprom i/o chip select i/o chip select program chip select gp chip select 1 gp chip select 1 gp chip select 2 gp chip select 2 program chip select tpg 75
motorola 4-34 MC68HC11KW1 operating modes and on-chip memory 4 4.5.4 csctl ?chip select control register ioen ?i/o chip select enable 1 (set) csio is enabled and uses port h pin 4. 0 (clear) csio is disabled and port h pin 4 is a general-purpose i/o pin. iopl ?i/o chip select polarity select 1 (set) csio is active high. 0 (clear) csio is active low. iocsa ?i/o chip select address valid 1 (set) csio is valid during address valid time. 0 (clear) csio is valid during e-clock high time. iosz ?i/o chip select size select 1 (set) csio size is 8k at $0000?1fff. 0 (clear) csio size is 4k at $1000?1fff. gcspr ?general-purpose chip select priority (refer to table 4-12) 1 (set) general-purpose chip selects have priority over program chip select. 0 (clear) program chip select has priority over general-purpose chip selects. pcsen ?program chip select enable 1 (set) csprog is enabled out of reset and uses port h pin 7. 0 (clear) csprog is disabled and port h pin 7 is a general-purpose i/o pin. pcsza and pcszb ?program chip select size (a or b) address bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 state on reset chip select control (csctl) $005b ioen iopl iocsa iosz gcspr pcsen pcsza pcszb 0000 0100 table 4-13 program chip select size pcsza pcszb size (b ytes) address range 0 0 64k $0000 ?$ffff 0 1 32k $8000 ?$ffff 1 0 16k $c000 ?$ffff 1 1 8k $e000 ?$ffff tpg 76
MC68HC11KW1 motorola 4-35 operating modes and on-chip memory 4 4.5.5 general-purpose chip selects the general-purpose chip selects are the most ?xible and programmable and have the most control bits. polarity of active state, e valid or address valid, size, and starting address are all programmable. clock stretching can be set from zero to three cycles. each general-purpose chip select has two registers. one, the control register gpcsxc, determines the logical output required when an area of memory is selected and the range of memory over which the chip select is to be active. each chip select can be programmed to become active whenever the cpu address enters a memory expansion window, regardless of the actual bank selected. this is known as following a window. the second, the address register gpcsxa, allows the starting address of the chip select to be programmed. the bits in this register that are valid are determined by the size of the chip select range selected by the control register. refer to the descriptions of the two associated registers for starting address and control information. in cases where one general-purpose chip select is programmed to drive the other general-purpose chip select or the program chip select, determine the priority from table 4-14. 4.5.5.1 gpcs1a ?general-purpose chip select 1 address register g1a[18:11] ?general-purpose chip select 1 address these bits select the starting address of general-purpose chip select 1 range. refer to table 4-15. table 4-14 general purpose chip select priority condition pr iority gpcs1 drives gpcs2 gpcs1 gpcs1 drives pcs gpcs1 gpcs2 drives pcs gpcs2 gpcs1 and gpcs2 drive pcs gpcs1 address bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 state on reset gen. pur pose chip select 1 addr. (gpcs1a) $005c g1a18 g1a17 g1a16 g1a15 g1a14 g1a13 g1a12 g1a11 0000 0000 tpg 77
motorola 4-36 MC68HC11KW1 operating modes and on-chip memory 4 4.5.5.2 gpcs1c ?general-purpose chip select 1 control register g1dg2 ?general-purpose chip select 1 drives general-purpose chip select 2 1 (set) csgp1 and csgp2 are or?d and driven out csgp2. 0 (clear) csgp1 does not affect csgp2. g1dpc ?general-purpose chip select 1 drives program chip select 1 (set) csgp1 and cspr og are or?d and driven out cspr og . 0 (clear) csgp1 does not affect cspr og . g1pol ?general-purpose chip select 1 polarity select 1 (set) csgp1 active high. 0 (clear) csgp1 active low. g1av ?general-purpose chip select 1 address valid select 1 (set) csgp1 is valid during address valid time. 0 (clear) csgp1 is valid during e high time. g1sza?1szd ?gp chip select 1 size these bits select the size for general-purpose chip select 1. refer to table 4-15. address bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 state on reset gen. pur pose chip select 1 con. (gpcs1c) $005d g1dg2 g1dpc g1pol g1av g1sza g1szb g1szc g1szd 0000 0000 tpg 78
MC68HC11KW1 motorola 4-37 operating modes and on-chip memory 4 4.5.5.3 gpcs2a ?general-purpose chip select 2 address register g2a[18:11] ?general-purpose chip select 2 address these bits select the starting address of general-purpose chip select 2 range. refer to table 4-16. 4.5.5.4 gpcs2c ?general-purpose chip select 2 control register bit 7 ?not implemented; always reads zero. g2dpc ?general-purpose chip select 2 drives program chip select 1 (set) csgp2 and cspr og are or'ed and driven out the cspr o g pin. 0 (clear) does not affect program chip select. table 4-15 general-purpose chip select 1 size control g1szx size (bytes) valid bits (mxgs1 = 0) valid bits (mxgs1 = 1) abcd 0 0 0 0 disabled none none 0 0 0 1 2 k g1a[15:11] g1a[18:11] 0 0 1 0 4 k g1a[15:12] g1a[18:12] 0 0 1 1 8 k g1a[15:13] g1a[18:13] 0 1 0 0 16 k g1a[15:14] g1a[18:14] 0 1 0 1 32 k a15 g1a[18:15] 0 1 1 0 64 k none g1a[18:16] 0 1 1 1 128 k none g1a[18:17] 1 0 0 0 256 k none g1a18 1 0 0 1 512 k none none 1 0 1 0 follow window 1 none none 1 0 1 1 follow window 2 none none 1100?111 def ault to 512 k none none address bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 state on reset gen. pur pose chip select 2 addr. (gpcs2a) $005e g2a18 g2a17 g2a16 g2a15 g2a14 g2a13 g2a12 g2a11 0000 0000 address bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 state on reset gen. pur pose chip select 2 con. (gpcs2c) $005f 0 g2dpc g2pol g2av g2sza g2szb g2szc g2szd 0000 0000 tpg 79
motorola 4-38 MC68HC11KW1 operating modes and on-chip memory 4 g2pol ?general-purpose chip select 2 polarity select 1 (set) csgp2 active high. 0 (clear) csgp2 active low. g2av ?general-purpose chip select 2 address valid select 1 (set) csgp2 is valid during address valid time. 0 (clear) csgp2 is valid during e high time. g2sza?2szd ?general-purpose chip select 2 size these bits select the size for general-purpose chip select 2. refer to table 4-16. 4.5.6 one chip select driving another the general-purpose chip selects can be programmed to drive the program chip select as well as each other. general-purpose chip select 1 drives general-purpose chip select 2 only. there are eight combinations of the bits g1dg2, g1dpc, and g2dpc. although all possible combinations are allowed, some combinations cause operations which do not perform as one might expect. the results of all combinations are de?ed in the following table. the priorities de?ed in the previous sections still apply. the following table assumes that none of the chip select ranges overlap. table 4-16 general-purpose chip select 2 size control g2szx size (bytes) valid bits (mxgs2 = 0) valid bits (mxgs2 = 1) abcd 0000 disabled none none 0001 2k g2a[15:11] g2a[18:11] 0010 4k g2a[15:12] g2a[18:12] 0011 8k g2a[15:13] g2a[18:13] 0100 16k g2a[15:14] g2a[18:14] 0101 32k g2a15 g2a[18:15] 0110 64k none g2a[18:16] 0111 128k none g2a[18:17] 1000 256k none g2a18 1001 512k none none 1010f ollow window 1 none none 1011f ollow window 2 none none 11100 ?1111 def ault to 512k none none tpg 80
MC68HC11KW1 motorola 4-39 operating modes and on-chip memory 4 4.5.7 clock stretching each chip select has two bits that enable clock stretching from zero to three cycles. a clock stretch can be programmed to occur only during accesses to addresses in that chip select's address range. during the clock stretch period the e clock is held high for additional full periods and the bus remains in its normal state at the end of the e high time. internally the clocks keep running so the integrity of the timers and baud rate generators is maintained. 4.5.7.1 cscstr ?chip select clock stretch register each of the following pairs of bits determines the clock stretch for one of the four chip selects. iosa, iosb ?csio stretch select gp1sa, gp1sb ?csgp1 stretch select gp2sa, gp2sb ?csgp2 stretch select pcsa, pcsb ?csprog stretch select in normal modes (smod = 0), pcsb is set on reset to give a one cycle stretch. in special modes (smod = 1), pcsb is cleared on reset. table 4-17 one chip select driving another g1dg 2 g1dpc g2dp c program cs pin asserted when address is in: general 2 cs pin asserted when ad dress is in: general 1 cs pin asserted when ad dress is in: 0 0 0 a valid program area a v alid general 2 area a valid general 1 area 0 0 1 a valid program or general 2 area never asserted a valid general 1 area 0 1 0 a valid program or general 1 area a valid general 2 area never asserted 0 1 1 a valid program or general 1 or 2 area never asserted never asserted 1 0 0 a valid program area a v alid general 2 or general 1 area never asserted 1 0 1 a valid program or general 2 area never asserted a valid general 1 area 1 1 0 a valid program or general 1 area a valid general 2 area never asserted 1 1 1 a valid program or general 1 or 2 area never asserted never asserted address bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 state on reset chip select clock stretch (cscstr) $005a iosa iosb gp1sa gp1sb gp2sa gp2sb pcsa pcsb 0000 000x bit [a: b] clock stretch 0 0 disabled 0 1 1 cycle 1 0 2 cycles 1 1 3 cycles tpg 81
motorola 4-40 MC68HC11KW1 operating modes and on-chip memory 4 table 4-18 chip select control parameter summary csio (i/o chip select) enable ioen in csctl ? 1 = on, off at reset (0) valid iocsa in csctl ? 1 = address v alid, 0 = e high polarity iopl in csctl ? 1 = active high, 0 = active low size iosz in csctl ? 1 = 4k ($1000?1fff) 0 = 8k ($0000?1fff) start address fixed (see size above) stretch io1sa:io1sb in cscstr ?0, 1, 2, or 3 e clocks csprog (pr ogram c hip select) enable pscen in csctl ?1 = on, on at reset valid fixed (address v alid) polarity fixed (active low) size pcsza:pcszb 0:0 = 64k ($0000?ffff) in csctl 0:1 = 32k ($8000?ffff) 1:0 = 16k ($c000?ffff) 1:1 = 8k ($e000?ffff) start address fixed (see size above) stretch pcsa:pcsb in cscstr ?0, 1, 2, or 3 e clocks priority gcspr in csctl ? 1 = csgpx above csprog 0 = csprog above csgpx csgp1, csgp2 (general purpose c hip selects) enable set size to 0k bytes to disable valid refer to gpcs1c / gpcs2c ?address v alid or e high polarity refer to gpcs1c / gpcs2c ?active high or low size refer to gpcs1c / gpcs2c ?2k to 512k in nine steps, 0k bytes = disable, can also follow memory expansion window 1 or window 2 start address refer to gpcs1a / gpcs2a stretch refer to cscstr ?0, 1, 2, or 3 e clocks other g1dg2 in gpcs1c allows csgp1 and csgp2 to be logically or'ed and driven out the csgp2 pin. g1dpc in gpcs1c allows csgp1 and csprog to be logically or'ed and driven out the csprog pin. g2dpc in gpcs2c allows csgp2 and csprog to be logically or'ed and driven out the csprog pin. mxgs2 in mmsiz allows csgp2 to f ollow either 64k cpu addresses or 512k expansion addresses. mxgs1 in mmsiz allows csgp1 to f ollow either 64k cpu addresses or 512k expansion addresses. tpg 82
MC68HC11KW1 motorola 4-41 operating modes and on-chip memory 4 4.6 eeprom and config register 4.6.1 eeprom the 640-byte on-board eeprom is initially located from $0d80 to $0fff after reset in all modes. it can be mapped to any other 4k page by writing to the init2 register. the eeprom is enabled by the eeon bit in the config register. programming and erasing are controlled by the pprog register. unlike information stored in rom, data in the 640 bytes of eeprom can be erased and reprogrammed under software control. because programming and erasing operations use an on-chip charge pump driven by v dd , a separate external power supply is not required. an internal charge pump supplies the programming voltage. seven bits in the block protect register (bprot) prevent inadvertent writes to (or erases of) blocks of eeprom, and the eighth bit enables the low voltage eeprom protect circuit (see section 4.3.2.6) . the csel bit in the option register selects an on-chip oscillator clock for programming and erasing the eeprom while operating at frequencies below 1mhz. in special modes there is one extra row of eeprom, which is used for factory testing. endurance and data retention speci?ations do not apply to these cells. the erased state of each eeprom byte is $ff. 4.6.1.1 pprog ?eeprom programming control register note: writes to eeprom addresses are inhibited while eepgm is one. a write to a different eeprom location is prevented while a program or erase operation is in progress. odd ?program odd rows in half of eeprom (test) even ?program even rows in half of eeprom (test) if both odd and even are set to one then all odd and even rows in half of the eeprom will be programmed with the same data, within one programming cycle. byte ?eeprom byte erase mode 1 (set) erase only one byte of eeprom. 0 (clear) row or bulk erase mode used. address bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 state on reset eeprom programming (pprog) $003b odd even 0 byte row erase eelat eepg m 0000 0000 tpg 83
motorola 4-42 MC68HC11KW1 operating modes and on-chip memory 4 this bit may be read or written at any time. row ?eeprom row/bulk erase mode (only valid when byte = 0) 1 (set) erase only one 16 byte row of eeprom. 0 (clear) erase all 640 bytes of eeprom. this byte can be read or written at any time. erase ?erase/normal control for eeprom 1 (set) erase mode. 0 (clear) normal read or program mode. this byte can be read or written at any time. eelat ?eeprom latch control 1 (set) eeprom address and data bus set up for programming or erasing. 0 (clear) eeprom address and data bus set up for normal reads. when the eelat bit is cleared, the eeprom can be read as if it were a rom. the block protect register has no effect during reads. this bit can be read and written at any time. eepgm ?eeprom program command 1 (set) program or erase voltage switched on to eeprom array. 0 (clear) program or erase voltage switched off to eeprom array. this bit can be read at any time but can only be written if eelat = 1. note: if eelat = 0 (normal operation) then eepgm = 0 (programming voltage disconnected). during eeprom programming, the row and byte bits of pprog are not used. if the frequency of the e clock is 1mhz or less, set the csel bit in the option register. remember that the eeprom must be erased by a separate erase operation before programming. the following table 4-19 erase mode selection byte row action 0 0 bulk erase (all 640 bytes) 0 1 row erase (16 bytes) 1 0 byte erase 1 1 byte erase tpg 84
MC68HC11KW1 motorola 4-43 operating modes and on-chip memory 4 example of how to program an eeprom byte assumes that the appropriate bits in bprot have been cleared. prog ldab #$02 eelat=1 stab $003b set eelat bit staa $0d80 store data to eeprom address ldab #$03 eelat=eepgm=1 stab $003b turn on programming voltage jsr dly10 delay teeprog clr $003b turn off high voltage and set to read mode 4.6.1.2 eeprom bulk erase to erase the eeprom, ensure that the appropriate bits in the bprot register are cleared, then complete the following steps using the pprog register: 1) write to pprog with the erase, eelat and appropriate byte and row bits set. 2) write to the appropriate eeprom address with any data. row erase only requires a write to any location in the row. bulk erase is accomplished by writing to any location in the array. 3) write to pprog with erase, eelat, eepgm and the appropriate byte and row bits set. 4) delay for time t eeprog (see section a.6). 5) clear the eepgm bit in pprog to turn off the high voltage. 6) clear the pprog register to recon?ure the eeprom address and data buses for normal operation. the following is an example of how to bulk erase the 640-byte eeprom. the config register is not affected in this example. bulke ldab #$06 eelat=erase=1 stab $003b set eelat bit staa $0d80 store data to any eeprom address ldab #$07 eelat=erase=eepgm=1 stab $003b turn on programming voltage jsr dly10 delay teeprog clr $003b turn off high voltage and set to read mode 4.6.1.3 eeprom row erase the following example shows how to perform a fast erase of 16 bytes of eeprom: rowe ldab #$0e row=erase=eelat=1 stab $003b set to row erase mode tpg 85
motorola 4-44 MC68HC11KW1 operating modes and on-chip memory 4 stab 0,x write any data to any address in row ldab #$0f row=erase=eelat=eepgm=1 stab $003b turn on high voltage jsr dly10 delay teeprog clr $003b turn off high voltage and set to read mode 4.6.1.4 eeprom byte erase the following is an example of how to erase a single byte of eeprom: bytee ldab #$16 byte=erase=eelat=1 stab $003b set to byte erase mode stab 0,x write any data to address to be erased ldab #$17 byte=erase=eelat=eepgm=1 stab $003b turn on high voltage jsr dly10 delay teeprog clr $003b turn off high voltage and set to read mode 4.6.2 config register programming because the config register is implemented with eeprom cells, use eeprom procedures to erase and program this register. the procedure for programming is the same as for programming a byte in the eeprom array, except that the config register address is used. config can be programmed or erased (including byte erase) while the mcu is operating in any mode, provided that ptcon in bprot is clear. to change the value in the config register, complete the following procedure. do not initiate a reset until the procedure is complete. 1) erase the config register. 2) program the new value to the config address. 3) initiate reset. config ?system con?uration register for a description of the bits contained in the config register refer to section 4.3.2.1. config is made up of eeprom cells and static working latches. the operation of the mcu is controlled directly by these latches and not the eeprom byte. when programming the config register, the eeprom byte is accessed. when the config register is read, the static latches are accessed. address bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 state on reset con?ur ation control (config) $003f 1 1 clkx paren nosec noco p 1 eeon 11xx xx1x tpg 86
MC68HC11KW1 motorola 4-45 operating modes and on-chip memory 4 these bits can be read at any time. the value read is the one latched into the register from the eeprom cells during the last reset sequence. a new value programmed into this register is not readable until after a subsequent reset sequence. bits in config can be written at any time if smod = 1 (bootstrap or special test mode). if smod = 0 (single chip or expanded mode), these bits can only be written using the eeprom programming sequence, and none of the bits is readable or active until latched via the next reset. 4.6.3 ram and eeprom security the optional security feature protects the contents of eeprom and ram from unauthorized access. data, codes, keys, a program, or a key portion of a program, can be protected against access. to accomplish this, the protection mechanism prevents operation of the device in special test mode. only resident programs have unlimited access to the internal eeprom and ram and can read, write, or transfer the contents of these memories. to maintain ram and eeprom security, access to external addresses should be restricted to data read or write. program execution should not point from the internal resources to the external memory map. note: a mask option on the MC68HC11KW1 determines whether or not the security feature is made available. if the feature is available, then the secure mode can be invoked by programming the nosec bit to zero. otherwise, the nosec bit is permanently set to one, disabling security. if the security feature is present and enabled and bootstrap mode is selected, then the following sequence is performed by the bootstrap program: 1) output $ff on the sci. 2) turn block protect off. clear bprot register. 3) if eeprom is enabled, erase it all. 4) verify that the eeprom is erased; if not, begin sequence again. 5) write $ff to every ram byte. 6) erase the config register. if all the above operations are successful, the bootloading process continues as if the device has not been secured. tpg 87
motorola 4-46 MC68HC11KW1 operating modes and on-chip memory 4 config ?system con?uration register for a description of the other bits contained in the config register refer to section 4.3.2.1. nosec ?eeprom security disabled 1 (set) disable security. 0 (clear) enable security. with security enabled, selection of special test mode is prevented; single chip and user expanded modes may be accessed. if the moda and modb pins are con?ured for special test mode, the part will start in bootstrap mode. address bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 state on reset con?ur ation control (config) $003f 1 1 clkx paren nosec noco p 1 eeon 11xx xx1x tpg 88
MC68HC11KW1 motorola 5-1 resets and interrupts 5 5 resets and interrupts resets and interrupt operations load the program counter with a vector that points to a new location from which instructions are to be fetched. a reset immediately stops execution of the current instruction and forces the program counter to a known starting address. internal registers and control bits are initialized so that the mcu can resume executing instructions. an interrupt temporarily suspends normal program execution whilst an interrupt service routine is being executed. after an interrupt has been serviced, the main program resumes as if there had been no interruption. 5.1 resets there are four possible sources of reset. power-on reset (por) and external reset share the normal reset vector. the computer operating properly (cop) reset and the clock monitor reset each has its own vector. 5.1.1 power-on reset a positive transition on vdd generates a power-on reset (por), which is used only for power-up conditions. por cannot be used to detect drops in power supply voltages. a delay is imposed which allows the clock generator to stabilize after the oscillator becomes active. if reset is at logical zero at the end of the delay time, the cpu remains in the reset condition until reset goes to logical one. it is important to protect the mcu during power transitions. most m68hc11 systems need an external circuit that holds the reset pin low whenever v dd is below the minimum operating level. this external voltage level detector, or other external reset circuits, are the usual source of reset in a system. the por circuit only initializes internal circuitry during power on. refer to figure 2-3. tpg 89
motorola 5-2 MC68HC11KW1 resets and interrupts 5 5.1.2 external reset (reset ) the cpu distinguishes between internal and external reset conditions by sensing whether the reset pin rises to a logic one in less than four e clock cycles after an internal device releases reset. when a reset condition is sensed, the reset pin is driven low by an internal device for eight e clock cycles, then released. four e clock cycles later it is sampled. if the pin is still held low, the cpu assumes that an external reset has occurred. if the pin is high, it indicates that the reset was initiated internally by either the cop system or the clock monitor. it is not advisable to connect an external resistor capacitor (rc) power-up delay circuit to the reset pin of m68hc11 devices because the circuit charge time constant can cause the device to misinterpret the type of reset that occurred. to guarantee recognition of an external reset, the reset pin should be held low for at least 16 clock cycles. 5.1.3 cop reset the mcu includes a cop system to help protect against software failures. when the cop is enabled, the software is responsible for keeping a free-running watchdog timer from timing out. when the software is no longer being executed in the intended sequence, a system reset is initiated. the state of the nocop bit in the config register determines whether the cop system is enabled or disabled. to change the enable status of the cop system, change the contents of the config register and then perform a system reset. in the special test and bootstrap operating modes, the cop system is initially inhibited by the disable resets (disr) control bit in the test1 register. the disr bit can subsequently be written to zero to enable cop resets. the cop timer rate control bits, cr[1:0], in the option register determine the cop timeout period. the system e clock is divided by 2 15 and then further scaled by the factor shown in table 5-1. after reset, bits cr[1:0] are zero, which selects the shortest timeout period. in normal operating modes, these bits can only be written once, within 64 bus cycles after reset. table 5-1 cop timer rate select cr[1:0] divide e/2 15 by extal = 16 mhz: timeout (1) (1) the timeout period has a tolerance of ?/+one cycle of the e/2 15 clock due to the asynchronous implementation of the cop circuitry. for example, with e = 4 m hz, the uncertainty is ?/+ 8.192 ms. see also the m68hc11 reference man ual, (m68hc11rm/ad) . 0 0 1 8.192 ms 0 1 4 32.768 ms 1 0 16 131.072 ms 1 1 64 524.288 ms e = 4 mhz tpg 90
MC68HC11KW1 motorola 5-3 resets and interrupts 5 5.1.3.1 coprst ?arm/reset cop timer circuitry register complete the following reset sequence to service the cop timer. write $55 to coprst to arm the cop timer clearing mechanism. then write $aa to coprst to clear the cop timer. executing instructions between these two steps is possible as long as both steps are completed in the correct sequence before the timer times out. 5.1.4 clock monitor reset the clock monitor circuit is based on an internal rc time delay. if no mcu clock edges are detected within this rc time delay, the clock monitor can optionally generate a system reset. the clock monitor function is enabled or disabled by the cme control bit in the option register. the presence of a timeout is determined by the rc delay, which allows the clock monitor to operate without any mcu clocks. clock monitor is used as a backup for the cop system. because the cop needs a clock to function, it is disabled when the clocks stop. therefore, the clock monitor system can detect clock failures not detected by the cop system. semiconductor wafer processing causes variations of the rc timeout values between individual devices. an e clock frequency below 10 khz is detected as a clock monitor error. an e clock frequency of 200 khz or more prevents clock monitor errors. use of the clock monitor function when the e clock is below 200 khz is not recommended. special considerations are needed when a stop instruction is executed and the clock monitor is enabled. because the stop function causes the clocks to be halted, the clock monitor function generates a reset sequence if it is enabled at the time the stop mode was initiated. before executing a stop instruction, clear the cme bit in the option register to zero to disable the clock monitor. after recovery from stop, set the cme bit to logic one to enable the clock monitor. address bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 state on reset cop timer arm/reset (coprst) $003a (bit 7) (6) (5) (4) (3) (2) (1) (bit 0) not aff ected tpg 91
motorola 5-4 MC68HC11KW1 resets and interrupts 5 5.1.5 option ?system con?uration options register 1 the special-purpose option register sets internal system con?uration options during initialization. the time protected control bits (irqe, dly, fcme and cr[1:0]) can be written to only once in the ?st 64 cycles after a reset and then they become read-only bits. this minimizes the possibility of any accidental changes to the system con?uration. they may be written at any time in special modes. adpu ?a/d power-up (refer to section 10) 1 (set) a/d system power enabled. 0 (clear) a/d system disabled, to reduce supply current. csel ?clock select (refer to section 10) 1 (set) a/d and eeprom use internal rc clock (about 1.5mhz). 0 (clear) a/d and eeprom use system e clock (must be at least 1mhz). irqe ?con?ure irq for falling-edge-sensitive operation (refer to section 4) 1 (set) falling-edge-sensitive operation. 0 (clear) low-level-sensitive operation. dly ?enable oscillator start-up delay (refer to section 4) 1 (set) a stabilization delay is imposed as the mcu is started up from stop mode (or from power-on reset). 0 (clear) the oscillator start-up delay is bypassed and the mcu resumes processing within about four bus cycles. a stable external oscillator is required if this option is selected. note: because dly is set on reset, a delay is always imposed as the mcu is started up from power-on reset. cme ?clock monitor enable 1 (set) clock monitor enabled. 0 (clear) clock monitor disabled. address bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 state on reset system con?. options 1 (option) $0039 adpu csel irqe dly cme fcme cr1 cr0 0001 0000 tpg 92
MC68HC11KW1 motorola 5-5 resets and interrupts 5 this control bit can be read or written at any time and controls whether or not the internal clock monitor circuit triggers a reset sequence when the system clock is slow or absent. when it is clear, the clock monitor circuit is disabled, and when it is set, the clock monitor circuit is enabled. reset clears the cme bit. in order to use both stop and clock monitor, the cme bit should be cleared before executing stop, then set again after recovering from stop. fcme ?force clock monitor enable 1 (set) clock monitor enabled; cannot be disabled until next reset. 0 (clear) clock monitor follows the state of the cme bit. when fcme is set, slow or stopped clocks will cause a clock failure reset sequence. to utilize stop mode, fcme should always be cleared. cr[1:0] ?cop timer rate select bits the internal e clock is ?st divided by 2 15 before it enters the cop watchdog system. these control bits determine a scaling factor for the watchdog timer period. see table 5-1. 5.1.6 config ?con?uration control register included in config are bits which control the presence of eeprom in the memory map and enable the cop watchdog system. config is made up of eeprom cells and static working latches. the operation of the mcu is controlled directly by these latches and not the eeprom byte. when programming the config register, the eeprom byte is accessed. when the config register is read, the static latches are accessed. these bits can be read at any time. the value read is the one latched into the register from the eeprom cells during the last reset sequence. a new value programmed into this register is not readable until after a subsequent reset sequence. bits in config can be written at any time if smod = 1 (bootstrap or special test mode). if smod = 0 (single chip or expanded mode), these bits can only be written using the eeprom programming sequence, and none of the bits are readable or active until latched via the next reset. bits [7, 6, 1] ?not implemented; always read one. address bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 state on reset con?ur ation control (config) $003f 1 1 clkx paren nosec noco p 1 eeon 11xx 1x1x tpg 93
motorola 5-6 MC68HC11KW1 resets and interrupts 5 clkx ?x clock enable (refer to section 4) 1 (set) xclk driven out on the xout pin. 0 (clear) xout pin disabled. paren ?pull-up assignment register enable (refer to section 6) 1 (set) ppar register enabled; pull-ups can be enabled using ppar. 0 (clear) ppar register disabled; all pull-ups disabled. nosec ?security disable (refer to section 4) 1 (set) disable security. 0 (clear) enable security. nocop ?cop system disable 1 (set) cop system disabled. 0 (clear) cop system enabled (forces reset on timeout). eeon ?eeprom enable (refer to section 4) 1 (set) eeprom included in the memory map. 0 (clear) eeprom excluded from the memory map. 5.2 effects of reset when a reset condition is recognized, the internal registers and control bits are forced to an initial state. depending on the cause of the reset and the operating mode, the reset vector can be fetched from any of six possible locations, as shown in table 5-2. these initial states then control on-chip peripheral systems to force them to known start-up states, as described in the following paragraphs. table 5-2 reset cause, reset vector and operating mode cause of reset normal mode vector special test or bootstrap por or reset pin $fffe, $ffff $bffe, $bfff clock monitor failure $fffc, $fffd $bffc, $bffd cop w atchdog timeout $fffa, $fffb $bffa, $bffb tpg 94
MC68HC11KW1 motorola 5-7 resets and interrupts 5 5.2.1 central processing unit after reset, the cpu fetches the restart vector from the appropriate address during the ?st three cycles, and begins executing instructions. the stack pointer and other cpu registers are indeterminate immediately after reset; however, the x and i interrupt mask bits in the condition code register (ccr) are set to mask any interrupt requests. also, the s-bit in the ccr is set to inhibit the stop mode. 5.2.2 memory map after reset, the init register is initialized to $00, putting the 768 bytes of ram at locations $00a0?039f, and the control registers at locations $0000?009f. the init2 register puts eeprom at locations $0d80?0fff. 5.2.3 parallel i/o when a reset occurs in expanded operating modes, port b, c, and f pins used for parallel i/o are dedicated to the expansion bus. if a reset occurs during a single chip operating mode, all ports are con?ured as general purpose high-impedance inputs. note: do not confuse pin function with the electrical state of the pin at reset. all general-purpose i/o pins con?ured as inputs at reset are in a high-impedance state. port data registers re?ct the ports functional state at reset. the pin function is mode dependent. 5.2.4 timer 1 during reset, the timer 1 system is initialized to a count of $0000. the prescaler bits for timer 1 are cleared, and all output compare registers are initialized to $ffff. all input capture registers are indeterminate after reset. the output compare 1 mask (oc1m) register is cleared so that successful oc1 compares do not affect any i/o pins. the other four output compares are con?ured so that they do not affect any i/o pins on successful compares. all input capture edge-detector circuits are con?ured for capture disabled operation. the timer over?w interrupt ?gs and all eight timer function interrupt ?gs are cleared. all nine timer interrupts are disabled because their mask bits have been cleared. the i4/o5 bit in the pactl register is cleared to con?ure the i4/o5 function as oc5; however, the om5:ol5 control bits in the tctl1 register are clear so oc5 does not control the pa3 pin. tpg 95
motorola 5-8 MC68HC11KW1 resets and interrupts 5 5.2.5 timers 2 and 3 during reset, each of these timer systems is initialized to a count of $0000. the eceb, ecea and prescaler bits are cleared so that the timers are driven by the internal e clock. the output compare registers are initialized to $ffff. the interrupt ?g registers (t2flg and t3flg) are cleared, along with the interrupt mask registers (t2msk and t3msk), disabling all interrupts. for each timer, the i1/o4 bit is clear to con?ure c4 as oc4, however, the om4:ol4 bits are clear so that oc4 does not affect the corresponding port pin. 5.2.6 real-time interrupt (rti) the real-time interrupt ?g (rtif) is cleared and automatic hardware interrupts are masked. the rate control bits are cleared after reset and can be initialized by software before the real-time interrupt (rti) system is used. 5.2.7 pulse accumulator the pulse accumulator system is disabled at reset so that the pulse accumulator input (pai) pin defaults to being a general-purpose input pin. 5.2.8 computer operating properly (cop) the cop watchdog system is enabled if the nocop control bit in the config register is cleared, and disabled if nocop is set. the cop rate is set for the shortest duration timeout. 5.2.9 serial communications interface (sci) the reset condition of the sci system is independent of the operating mode. at reset, the sci baud rate control register is initialized to $0004. all transmit and receive interrupts are masked and both the transmitter and receiver are disabled so the port pins default to being general purpose i/o lines. the sci frame format is initialized to an 8-bit character size. the send break and receiver wake-up functions are disabled. the tdre and tc status bits in the sci status register are both set, indicating that there is no transmit data in either the transmit data register or the transmit serial shift register. the rdrf, idle, or, nf, fe, pf, and raf receive-related status bits are cleared. tpg 96
MC68HC11KW1 motorola 5-9 resets and interrupts 5 5.2.10 serial peripheral interface (spi) the spi system is disabled by reset. its associated port pins default to being general-purpose i/o lines. 5.2.11 analog-to-digital converter the a/d converter con?uration is indeterminate after reset. the adpu bit is cleared by reset, which disables the a/d system. 5.2.12 system the eeprom programming controls are disabled, so the memory system is con?ured for normal read operation. psel[4:0] are initialized with the binary value%00110, causing the external irq pin to have the highest i-bit interrupt priority. the irq pin is con?ured for level-sensitive operation (for wired-or systems). the rboot, smod, and mda bits in the hprio register re?ct the status of the modb and moda inputs at the rising edge of reset. the dly control bit is set to specify that an oscillator start-up delay is imposed upon recovery from stop mode or power-on reset. the clock monitor system is disabled because cme and fcme are cleared. 5.3 reset and interrupt priority resets and interrupts have a hardware priority that determines which reset or interrupt is serviced ?st when simultaneous requests occur. any maskable interrupt can be given priority over other maskable interrupts. the ?st six interrupt sources are not maskable by the i-bit in the ccr. the priority arrangement for these sources is ?ed and is as follows: 1) por or reset pin 2) clock monitor reset 3) cop watchdog reset 4) xirq interrupt illegal opcode interrupt ?see section 5.4.3 for details of handling software interrupt (swi) ?see section 5.4.4 for details of handling the maskable interrupt sources have the following priority arrangement: 5) irq 6) real-time interrupt 7) timer 1 input capture 1 tpg 97
motorola 5-10 MC68HC11KW1 resets and interrupts 5 8) timer 1 input capture 2 9) timer 1 input capture 3 10) timer 1 output compare 1 11) timer 1 output compare 2 12) timer 1 output compare 3 13) timer 1 output compare 4 14) timer 1 input capture 4/output compare 5 15) timer 2 output compare 1, 2, 3 16) timer 2 input capture 1/output compare 4 17) timer 1 over?w 18) timer 2 over?w 19) pulse accumulator over?w 20) pulse accumulator input edge 21) timer 3 capture/compare 22) timer 3 over?w 23) spi transfer complete 24) sci system any one of these maskable interrupts can be assigned the highest maskable interrupt priority by writing the appropriate value to the psel bits in the hprio register. otherwise, the priority arrangement remains the same. an interrupt that is assigned highest priority is still subject to global masking by the i-bit in the ccr, or by any associated local bits. interrupt vectors are not affected by priority assignment. to avoid race conditions, hprio can only be written while i-bit interrupts are inhibited. 5.3.1 hprio ?highest priority i-bit interrupt and misc. register rboot, smod, and mda bits depend on power-up initialization mode and can only be written in special modes when smod = 1. refer to table 4-4. rboot ?read bootstrap rom (refer to section 4) 1 (set) bootloader rom enabled, at $be40?bfff. 0 (clear) bootloader rom disabled and not in map. address bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 state on reset highest prior ity interr upt (hprio) $003c rboot smod mda psel4 psel3 psel2 psel1 psel0 xxx0 0110 tpg 98
MC68HC11KW1 motorola 5-11 resets and interrupts 5 smod ?special mode select (refer to section 4) 1 (set) special mode variation in effect. 0 (clear) normal mode variation in effect. mda ?mode select a (refer to section 4) 1 (set) normal expanded or special test mode in effect. 0 (clear) normal single chip or special bootstrap mode in effect. psel[4:0] ?priority select bits these bits select one interrupt source to be elevated above all other i-bit-related sources and can be written to only while the i-bit in the ccr is set (interrupts disabled). see table 5-3. table 5-3 highest priority interrupt selection pselx interrupt source pr omoted 43210 0 0 0 x x reserved (def ault to irq ) 00100 reserved (def ault to irq ) 00101 reserved (def ault to irq ) 00110irq (external pin) 00111 real-time interrupt 01000 timer 1 input capture 1 01001 timer 1 input capture 2 01010 timer 1 input capture 3 01011 timer 1 output compare 1 01100 timer 1 output compare 2 01101 timer 1 output compare 3 01110 timer 1 output compare 4 01111 timer 1 output compare 5/input capture 4 10101 timer 2 output compare 1, 2, 3 10110 timer 2 input capture1/output compare 4 10000 timer 1 over?w 10111 timer 2 over?w 10001 pulse accum ulator over?w 10010 pulse accum ulator input edge 11000 timer 3 input capture/output compare 11001 timer 3 over?w 10011 spi serial transfer complete 10100 sci serial system 1101x reserved (def ault to irq ) 1 1 1 x x reserved (def ault to irq ) tpg 99
motorola 5-12 MC68HC11KW1 resets and interrupts 5 table 5-4 interrupt and reset vector assignments vector address interrupt source ccr mask bit local mask ffc0, c1 ?ffca, cb reserved ffcc, ffcd ?imer 3 over?w i to3i ffce, ffcf ?imer 3 input capture 1/output compare 4 ?imer 3 output compare 1 ?imer 3 output compare 2 ?imer 3 output compare 3 i c4i oc1i oc2i oc3i ffd0, ffd1 timer 2 over?w i to2i ffd2, ffd3 timer 2 input capture 1/output compare 4 i c4i ffd4, d5 ?imer 2 output compare 1 ?imer 2 output compare 2 ?imer 2 output compare 3 i oc1i oc2i oc3i ffd6, d7 ?sci receive data register full ?sci receiver overrun ?sci tr ansmit data register empty ?sci tr ansmit complete ?sci idle line detect i rie rie tie tcie ilie ffd8, d9 spi ser ial transfer complete i spie ffda, db pulse accum ulator input edge i paii ffdc, dd pulse accum ulator over?w i paovi ffde, df timer 1 over?w i toi ffe0, e1 timer 1 input capture 4/output compare 5 i i4/o5i ffe2, e3 timer 1 output compare 4 i oc4i ffe4, e5 timer 1 output compare 3 i oc3i ffe6, e7 timer 1 output compare 2 i oc2i ffe8, e9 timer 1 output compare 1 i oc1i ffea, eb timer 1 input capture 3 i ic3i ffec, ed timer 1 input capture 2 i ic2i ffee, ef timer 1 input capture 1 i ic1i fff0, f1 real-time interrupt i rtii fff2, f3 irq pin i none fff4, f5 xirq pin x none fff6, f7 softw are interrupt none none fff8, f9 illegal opcode trap none none fffa, fb cop f ailure none noco p fffc, fd clock monitor fail none cme fffe, ff reset none none tpg 100
MC68HC11KW1 motorola 5-13 resets and interrupts 5 5.4 interrupts excluding reset type interrupts, the MC68HC11KW1 has 23 interrupt vectors that support 32 interrupt sources. the 20 maskable interrupts are generated by on-chip peripheral systems. these interrupts are recognized when the global interrupt mask bit (i) in the condition code register (ccr) is clear. the three nonmaskable interrupt sources are illegal opcode trap, software interrupt, and xirq pin. refer to table 5-4, which shows the interrupt sources and vector assignments for each source. for some interrupt sources, such as the sci interrupts, the ?gs are automatically cleared during the normal course of responding to the interrupt requests. for example, the rdrf ?g in the sci system is cleared by the automatic clearing mechanism consisting of a read of the sci status register while rdrf is set, followed by a read of the sci data register. the normal response to an rdrf interrupt request would be to read the sci status register to check for receive errors, then to read the received data from the sci data register. these two steps satisfy the automatic clearing mechanism without requiring any special instructions. 5.4.1 interrupt recognition and register stacking an interrupt can be recognized at any time after it is enabled by its local mask, if any, and by the global mask bit in the ccr. once an interrupt source is recognized, the cpu responds at the completion of the instruction being executed. interrupt latency varies according to the number of cycles required to complete the current instruction. when the cpu begins to service an interrupt, the contents of the cpu registers are pushed onto the stack in the order shown in table 5-5. after the ccr value is stacked, the i-bit and the x-bit, if xirq is pending, are set to inhibit further interrupts. the interrupt vector for the highest priority pending source is fetched, and execution continues at the address speci?d by the vector. at the end of the interrupt service routine, the return from interrupt instruction is executed and the saved registers are pulled from the stack in reverse order so that normal program execution can resume. refer to section 3 for further information. table 5-5 stacking order on entry to interrupts memory location cpu registers sp pcl sp ?1 pch sp ?2 iyl sp ?3 iyh sp ?4 ixl sp ?5 ixh sp ?6 acca sp ?7 accb sp ?8 ccr tpg 101
motorola 5-14 MC68HC11KW1 resets and interrupts 5 5.4.2 nonmaskable interrupt request (xirq ) nonmaskable interrupts are useful because they can always interrupt cpu operations. the most common use for such an interrupt is for serious system problems, such as program runaway or power failure. the xirq input is an updated version of the nmi (nonmaskable interrupt) input of earlier mcus. upon reset, both the x-bit and i-bit of the ccr are set to inhibit all maskable interrupts and xirq . after minimum system initialization, software can clear the x-bit by a tap instruction, enabling xirq interrupts. thereafter, software cannot set the x-bit. thus, an xirq interrupt is a nonmaskable interrupt. because the operation of the i-bit-related interrupt structure has no effect on the x-bit, the internal xirq pin remains unmasked. in the interrupt priority logic, the xirq interrupt has a higher priority than any source that is maskable by the i-bit. all i-bit-related interrupts operate normally with their own priority relationship. when an i-bit-related interrupt occurs, the i-bit is automatically set by hardware after stacking the ccr byte. the x-bit is not affected. when an x-bit-related interrupt occurs, both the x and i bits are automatically set by hardware after stacking the ccr. a return from interrupt instruction restores the x and i bits to their pre-interrupt request state. 5.4.3 illegal opcode trap because not all possible opcodes or opcode sequences are de?ed, the mcu includes an illegal opcode detection circuit, which generates an interrupt request. when an illegal opcode is detected and the interrupt is recognized, the current value of the program counter is stacked. after interrupt service is complete, the user should reinitialize the stack pointer to ensure that repeated execution of illegal opcodes does not cause stack under?w. left uninitialized, the illegal opcode vector can point to a memory location that contains an illegal opcode. this condition causes an in?ite loop that causes stack under?w. the stack grows until the system crashes. the illegal opcode trap mechanism works for all unimplemented opcodes on all four opcode map pages. the address stacked as the return address for the illegal opcode interrupt is the address of the ?st byte of the illegal opcode. otherwise, it would be almost impossible to determine whether the illegal opcode had been one or two bytes. the stacked return address can be used as a pointer to the illegal opcode, so that the illegal opcode service routine can evaluate the offending opcode. 5.4.4 software interrupt swi is an instruction, and thus cannot be interrupted until complete. swi is not inhibited by the global mask bits in the ccr. because execution of swi sets the i mask bit, once an swi interrupt begins, other interrupts are inhibited until swi is complete, or until user software clears the i bit in the ccr. tpg 102
MC68HC11KW1 motorola 5-15 resets and interrupts 5 5.4.5 maskable interrupts the maskable interrupt structure of the mcu can be extended to include additional external interrupt sources through the irq pin. the default con?uration of this pin is a low-level sensitive wired-or network. when an event triggers an interrupt, a software accessible interrupt ?g is set. when enabled, this ?g causes a constant request for interrupt service. after the ?g is cleared, the service request is released. 5.4.6 reset and interrupt processing the following ?w diagrams illustrate the reset and interrupt process. figure 5-1 and figure 5-2 illustrate how the cpu begins from a reset and how interrupt detection relates to normal opcode fetches. figure 5-3 to figure 5-4 provide an expanded version of a block in figure 5-1 and illustrate interrupt priorities. figure 5-6 shows the resolution of interrupt sources within the sci subsystem. 5.5 low power operation both stop and wait suspend cpu operation until a reset or interrupt occurs. the wait condition suspends processing and reduces power consumption to an intermediate level. the stop condition turns off all on-chip clocks and reduces power consumption to an absolute minimum while retaining the contents of all bytes of the ram. 5.5.1 wait the wai opcode places the mcu in the wait condition, during which the cpu registers are stacked and cpu processing is suspended until a quali?d interrupt is detected. the interrupt can be an external irq , an xirq , or any of the internally generated interrupts, such as the timer or serial interrupts. the on-chip crystal oscillator remains active throughout the wait stand-by period. the reduction of power in the wait condition depends on how many internal clock signals driving on-chip peripheral functions can be shut down. the cpu is always shut down during wait. while in the wait state, the address/data bus repeatedly runs read cycles to the address where the ccr contents were stacked. the mcu leaves the wait state when it senses any interrupt that has not been masked. the free-running timer 1 system is stopped only if the i-bit is set and the cop system is disabled by nocop being set. timers 2 and 3 can be stopped under the control of bits in the tctl4 and tctl6 registers, respectively. several other systems can also be in a reduced power consumption state depending on the state of software-controlled con?uration control bits. power consumption by the analog-to-digital (a/d) converter is not affected signi?antly by the wait condition. tpg 103
motorola 5-16 MC68HC11KW1 resets and interrupts 5 however, the a/d converter current can be reduced by writing the adpu bit to zero and halting the rc clock (csel cleared). if the reference voltages v rh , v rl are supplied then the interval resistor chain still consumes current. for 5v v rh - v rl , a worst case current consumption of 260 m a is speci?d for the a/d converter. the spi system is enabled or disabled by the spe control bit. the sci transmitter is enabled or disabled by the te bit, and the sci receiver is enabled or disabled by the re bit (lowest power consumption is achieved when re=te=0). power consumption is reduced if all the pwm enable bits (pwen[4:1]) are cleared, thereby disabling every pwm channel. therefore the power consumption in wait is dependent on the particular application. 5.5.2 stop executing the stop instruction while the s-bit in the ccr is clear places the mcu in the stop condition. if the s-bit is set, the stop opcode is treated as a no-op (nop). the stop condition offers minimum power consumption because all clocks, including the crystal oscillator, are stopped while in this mode. to exit stop and resume normal processing, a logic low level must be applied to one of the external interrupts (irq or xirq ) or to the reset pin. a pending edge-triggered irq can also bring the cpu out of stop. because all clocks are stopped in this mode, all internal peripheral functions also stop. the data in the internal ram is retained as long as v dd power is maintained. the cpu state and i/o pin levels are static and are unchanged by stop. therefore, when an interrupt comes to restart the system, the mcu resumes processing as if there were no interruption. if reset is used to restart the system a normal reset sequence results where all i/o pins and functions are also restored to their initial states. to use the irq pin as a means of recovering from stop, the i-bit in the ccr must be clear (irq not masked). the xirq pin can be used to wake up the mcu from stop regardless of the state of the x-bit in the ccr, although the recovery sequence depends on the state of the x-bit. if x is clear (xirq not masked), the mcu starts up, beginning with the stacking sequence leading to normal service of the xirq request. if x is set (xirq masked or inhibited), then processing continues with the instruction that immediately follows the stop instruction, and no xirq interrupt service is requested or pending. because the oscillator is stopped in stop mode, a restart delay may be imposed to allow oscillator stabilization upon leaving stop. if the internal oscillator is being used, this delay is required; however, if a stable external oscillator is being used, the dly control bit can be used to bypass this start-up delay. the dly control bit is set by reset and can be optionally cleared during initialization. if the dly equal to zero option is used to avoid start-up delay on recovery from stop, then reset should not be used as the means of recovering from stop, as this causes dly to be set again by reset, imposing the restart delay. this same delay also applies to power-on-reset, regardless of the state of the dly control bit, but does not apply to a reset while the clocks are running. see section 4.3.2.4. tpg 104
MC68HC11KW1 motorola 5-17 resets and interrupts 5 figure 5-1 processing ?w out of reset (1 of 2) xirq pin low? clock monitor fail (cme = 1) cop w atchdog timeout (nocop = 0) begin an instruction sequence external reset power-on reset (por) delay (4064 cycles) load program counter with contents of $fffc, $fffd (vector fetch) load program counter with contents of $fffe, $ffff (vector fetch) load program counter with contents of $fffa, $fffb (vector fetch) set s, x, and i bits in ccr. reset mcu hardware x-bit in ccr set? stack cpu registers. set x and i bits. fetch vector at $fff4, $fff5 1a 1b no no yes yes priority highest lowest tpg 105
motorola 5-18 MC68HC11KW1 resets and interrupts 5 figure 5-2 processing ?w out of reset (2 of 2) rti? fetch opcode swi? stack cpu registers. set i bit. fetch vector at $fff8, $fff9 1b 1a i-bit in ccr set? i-bit interrupt pending? legal opcode? wai? execute this inst ruction yes no no yes no no no stack cpu registers. set i bit. fetch vector at $fff6, $fff7 restore cpu registers from stack yes yes no stack cpu registers stack cpu registers interrupt yet? set i-bit resolve interrupt priority and fetch vector for highest pending source (figure 5-3) yes yes no start next instr uction sequence yes tpg 106
MC68HC11KW1 motorola 5-19 resets and interrupts 5 figure 5-3 interrupt priority resolution (1 of 3) x-bit in ccr set? highest priority interr upt? rtii = 1? ic1i = 1? ic2i = 1? ic3i = 1? oc1i = 1? begin irq ? 2a xirq pin low? set x-bit in ccr. fetch vector at $fff4, $fff5 fetch vector fetch vector at $fff2, $fff3 fetch vector at $fff0, $fff1 fetch vector at $ffee, $ffef fetch vector at $ffec, $ffed fetch vector at $ffea, $ffeb no yes fetch vector at $ffe8, $ffe9 rtif = 1? ic1f = 1? ic2f = 1? ic3f = 1? oc1f = 1? 2b yes yes yes yes yes yes yes no no no no no no no yes yes yes yes yes no no no no no no yes tpg 107
motorola 5-20 MC68HC11KW1 resets and interrupts 5 figure 5-4 interrupt priority resolution (2 of 3) timer 2 c4i = 1? fetch vector at $ffd2, $ffd3 c4f = 1? no yes no yes oc2i = 1? oc3i = 1? oc4i = 1? i4/o5i = 1? 2a fetch vector at $ffe6, $ffe7 fetch vector at $ffe4, $ffe5 fetch vector at $ffe2, $ffe3 fetch vector at $ffe0, $ffe1 oc2f = 1? oc3f = 1? oc4f = 1? i4/o5f = 1? 2b yes yes yes yes no no no yes yes yes yes no no no no 2c 2d toi = 1? fetch vector at $ffde, $ffdf tof = 1? yes no yes no no fetch vector at $ffd4, $ffd5 timer 2 oc[3:1] inter rupt? ? no yes to2i = 1? fetch vector at $ffd0, $ffd1 to2f = 1? yes no yes no ? flag polling is required to determine the source of this interrupt (refer to section 9). tpg 108
MC68HC11KW1 motorola 5-21 resets and interrupts 5 figure 5-5 interrupt priority resolution (3 of 3) 2c 2d fetch vector at $fff2, $fff3 spur ious interr upt ?take irq vector ? flag polling is required to determine the source of this interrupt (refer to section 9). ? refer to figure 5-6 for further details on sci interr upts. t03i = 1? fetch vector at $ffcc, $ffcd to3f = 1? fetch vector at $ffce, $ffcf end timer 3 oc / ic inter rupt? ? no yes no yes no yes paii = 1? fetch vector at $ffda, $ffdb paif = 1? yes no yes no spie = 1? fetch vector at $ffd8, $ffd9 spif = 1? yes no yes no modf = 1? no yes paovi = 1? fetch vector at $ffdc, $ffdd paovf = 1? yes no yes no sci interr upt? no yes fetch vector at $ffd6, $ffd7 tpg 109
motorola 5-22 MC68HC11KW1 resets and interrupts 5 figure 5-6 interrupt source resolution within the sci subsystem no begin rdrf = 1? or = 1? tdre = 1? tc = 1? idle = 1? no valid sci interr upt request rie = 1? te = 1? re = 1? tie = 1? tcie = 1? ilie = 1? re = 1? valid sci interr upt request yes yes yes yes yes yes yes yes yes yes yes yes no no no no no no no no no no no tpg 110
MC68HC11KW1 motorola 6-1 parallel input/output 6 6 parallel input/output the MC68HC11KW1 has up to 70 input/output lines and 10 input-only lines, depending on the operating mode. to enhance the i/o functions, the data bus of this microcontroller is non-multiplexed. the following table is a summary of the con?uration and features of each port. note: do not confuse pin function with the electrical state of that pin at reset. all general-purpose i/o pins that are con?ured as inputs at reset are in a high-impedance state and the contents of the port data registers are unde?ed; in port descriptions, a ? indicates this condition. the pin function is mode dependent. table 6-1 port con?uration port input pins output pins bidirectional pins alternative functions a 8 timer 1 b 8 high order address c 8 data bus d 8 sci and spi e 8 a/d converter f 8 low order address g 2 6 memory e xpansion and a/d converter h 8 chip selects and pwm j 8 timer 2 k 8 timer 3 tpg 111
motorola 6-2 MC68HC11KW1 parallel input/output 6 6.1 port a port a is an 8-bit bidirectional port, with both data and data direction registers. in addition to their i/o capability, port a pins are shared with timer 1 functions, as shown in the following table. on reset the pins are con?ured as general purpose high-impedance inputs. 6.1.1 porta ?port a data register this is a read/write register and is not affected by reset. the bits may be read and written at any time, but, when a pin is allocated to its alternate function, a write to the corresponding register bit has no effect on the pin state. 6.1.2 ddra ?data direction register for port a dda[7:0] ?data direction for port a 1 (set) the corresponding pin is con?ured as an output. 0 (clear) the corresponding pin is con?ured as an input. pin alternative function pa0 ic3 pa1 ic2 pa2 ic1 pa3 oc5 and/or oc1, or ic4 pa4 oc4 and/or oc1 pa5 oc3 and/or oc1 pa6 oc2 and/or oc1 pa7 pai and/or oc1 address bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 state on reset port a data (porta) $0000 pa7 pa6 pa5 pa4 pa3 pa2 pa1 pa0 unde?ed address bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 state on reset data direction a (ddra) $0001 dda7 dda6 dda5 dda4 dda3 dda2 dda1 dda0 0000 0000 ? ? see section 9 for more information. tpg 112
MC68HC11KW1 motorola 6-3 parallel input/output 6 6.2 port b port b is an 8-bit bidirectional port, with both data and data direction registers. in addition to their i/o capability, port b pins are used as the non-multiplexed high order address pins, as shown in the following table. the state of the pins on reset is mode dependent. in single chip or bootstrap mode, port b pins are high-impedance inputs with selectable internal pull-up resistors (see section 6.11). in expanded or test mode, port b pins are high order address outputs and portb/ddrb are not in the memory map. 6.2.1 portb ?port b data register these bits may be read and written at any time and are not affected by reset. 6.2.2 ddrb ?data direction register for port b ddb[7:0] ?data direction for port b 1 (set) the corresponding pin is con?ured as an output. 0 (clear) the corresponding pin is con?ured as an input. pin alternative function pb0 addr8 pb1 addr9 pb2 addr10 pb3 addr11 pb4 addr12 pb5 addr13 pb6 addr14 pb7 addr15 address bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 state on reset port b data (portb) $0004 pb7 pb6 pb5 pb4 pb3 pb2 pb1 pb0 unde?ed address bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 state on reset data direction b (ddrb) $0002 ddb7 ddb6 ddb5 ddb4 ddb3 ddb2 ddb1 ddb0 0000 0000 ? ? in expanded or test mode, the pins become the high order address lines and port b is not included in the memory map. tpg 113
motorola 6-4 MC68HC11KW1 parallel input/output 6 6.3 port c port c is an 8-bit bidirectional port, with both data and data direction registers. in addition to their i/o capability, port c pins are used as the non-multiplexed data bus pins, as shown in the following table. the state of the pins on reset is mode dependent. in single chip or bootstrap mode, port c pins are high-impedance inputs. in expanded or test modes, port c pins are the data bus i/o and portc/ddrc are not in the memory map. 6.3.1 portc ?port c data register the bits may be read and written at any time and are not affected by reset. 6.3.2 ddrc ?data direction register for port c ddc[7:0] ?data direction for port c 1 (set) the corresponding pin is con?ured as an output. 0 (clear) the corresponding pin is con?ured as an input. pin alternative function pc0 data0 pc1 data1 pc2 data2 pc3 data3 pc4 data4 pc5 data5 pc6 data6 pc7 data7 address bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 state on reset port c data (portc) $0006 pc7 pc6 pc5 pc4 pc3 pc2 pc1 pc0 unde?ed address bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 state on reset data direction c (ddrc) $0007 ddc7 ddc6 ddc5 ddc4 ddc3 ddc2 ddc1 ddc0 0000 0000 ? ? in expanded or test mode, the pins become the data bus and port c is not included in the memory map. tpg 114
MC68HC11KW1 motorola 6-5 parallel input/output 6 6.4 port d port d is an 8-bit bidirectional port, with both data and data direction registers. in addition to their i/o capability, six of port ds pins are shared with sci and spi functions, as shown in the following table. on reset the pins are con?ured as general purpose high-impedance inputs. 6.4.1 portd ?port d data register this is a read/write register and is not affected by reset. the bits may be read and written at any time, but, when a pin is allocated to an alternate function, a write to the corresponding register bit has no effect on the pin state. 6.4.2 ddrd ?data direction register for port d ddd[7:0] ?data direction for port d 1 (set) the corresponding pin is con?ured as an output. 0 (clear) the corresponding pin is con?ured as an input. pin alternative function pd0 rxd pd1 txd pd2 miso pd3 mosi pd4 sck pd5 ss address bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 state on reset port d data (portd) $0008 pd7 pd6 pd5 pd4 pd3 pd2 pd1 pd0 unde?ed address bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 state on reset data direction d (ddrd) $0009 ddd7 ddd6 ddd5 ddd4 ddd3 ddd2 ddd1 ddd0 0000 0000 see section 8 for more information. see section 7 for more information. ? ? ? ? tpg 115
motorola 6-6 MC68HC11KW1 parallel input/output 6 6.5 port e port e is an input-only port. in addition to their input capability, port e pins are shared with a/d functions, as shown in the following table. on reset, the pins are con?ured as general purpose high-impedance inputs. 6.5.1 porte ?port e data register this is a read-only register and is not affected by reset. the bits may be read at any time. note: as port e shares pins with the a/d converter, a read of this register may affect any conversion currently in progress, if it coincides with the sample portion of the conversion cycle. hence, normally port e should not be read during the sample portion of any conversion. pin alternative function pe0 an2 pe1 an3 pe2 an4 pe3 an5 pe4 an6 pe5 an7 pe6 an8 pe7 an9 address bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 state on reset port e data (porte) $000a pe7 pe6 pe5 pe4 pe3 pe2 pe1 pe0 unde?ed ? ? see section 10 for more information. tpg 116
MC68HC11KW1 motorola 6-7 parallel input/output 6 6.6 port f port f is an 8-bit bidirectional port, with both data and data direction registers. in addition to their i/o capability, port f pins are used as the non-multiplexed low order address pins, as shown in the following table. the state of the pins on reset is mode dependent. in single chip or bootstrap mode, port f pins are high-impedance inputs with selectable internal pull-up resistors (see section 6.11). in expanded or test modes, port f pins are low order address outputs and portf/ddrf are not in the memory map. 6.6.1 portf ?port f data register the bits may be read and written at any time and are not affected by reset. 6.6.2 ddrf ?data direction register for port f ddf[7:0] ?data direction for port f 1 (set) the corresponding pin is con?ured as an output. 0 (clear) the corresponding pin is con?ured as an input. pin alternative function pf0 addr0 pf1 addr1 pf2 addr2 pf3 addr3 pf4 addr4 pf5 addr5 pf6 addr6 pf7 addr7 address bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 state on reset port f data (portf) $0005 pf7 pf6 pf5 pf4 pf3 pf2 pf1 pf0 unde?ed address bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 state on reset data direction f (ddrf) $0003 ddf7 ddf6 ddf5 ddf4 ddf3 ddf2 ddf1 ddf0 0000 0000 ? ? in expanded or test mode, the pins become the low order address and port f is not included in the memory map. tpg 117
motorola 6-8 MC68HC11KW1 parallel input/output 6 6.7 port g port g is an 8-bit port, with both data and data direction registers. pins [7, 6] are input-only, and may be used as general purpose inputs, or as inputs to the a/d converter. pins [5:0] are fully bidirectional, and, in addition to their i/o capability, are shared with memory expansion functions, as shown in the following table. the functions of pins [5:0] are controlled by bits in the port g assignment register, pgar. note: the input timing characteristics of pins pg[7, 6] are different from the other port g pins. refer to section a.5.1. 6.7.1 portg ?port g data register this is a read/write register and is not affected by reset. the bits may be read and written at any time, but, when a pin is allocated to its alternate function, a write to the corresponding register bit has no effect on the pin state. port g pins [5:0] have internal, software-selectable pull-up resistors which are controlled by the ppar register. see section 6.11.1. note: as port g shares two pins with the a/d converter, a read of this register may affect any conversion currently in progress, if it coincides with the sample portion of the conversion cycle. hence, normally port g should not be read during the sample portion of any conversion. pin alternative function pg0 xa13 pg1 xa14 pg2 xa15 pg3 xa16 pg4 xa17 pg5 xa18 pg6 an0 pg7 an1 address bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 state on reset port g data (portg) $007e pg7 pg6 pg5 pg4 pg3 pg2 pg1 pg0 unde?ed see section 4 for more information. ? ? ? ? see section 10 for more information. tpg 118
MC68HC11KW1 motorola 6-9 parallel input/output 6 6.7.2 ddrg ?data direction register for port g bits [7, 6] ? not implemented; always read zero ddg[5:0] ?data direction for port g 1 (set) the corresponding pin is con?ured as an output. 0 (clear) the corresponding pin is con?ured as an input. 6.7.3 pgar ?port g assignment register pgar selects which port g pins are used for i/o or memory expansion address lines, de?ing which extended address lines are used. selecting an address on one of these pins causes a port g pin to be lost. for this reason, select only those address lines that are needed by the expansion logic. this allows unused lines to serve as general-purpose i/o. for more information, refer to section 4.4. bits [7:6] ?not implemented; always read zero pgar[5:0] ?port g pin assignment 1 (set) corresponding port g pin is expansion address line (xa[18:13]). 0 (clear) corresponding port g pin is general-purpose i/o. address bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 state on reset data direction g (ddrg) $007f 0 0 ddg5 ddg4 ddg3 ddg2 ddg1 ddg0 0000 0000 address bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 state on reset port g assignment (pgar) $002d 0 0 pgar5 pagr4 pgar3 pgar2 pgar1 pgar0 0000 0000 tpg 119
motorola 6-10 MC68HC11KW1 parallel input/output 6 6.8 port h port h is an 8-bit, bidirectional port, with both data and data direction registers. in addition to their i/o capability, port h pins are shared with chip select and pwm functions, as shown in the following table. 6.8.1 porth ?port h data register this is a read/write register and is not affected by reset. the bits may be read and written at any time, but, when a pin is allocated to its alternate function, a write to the corresponding register bit has no effect on the pin state. port h has internal, software selectable pull-up resistors which are controlled by the ppar register. see section 6.11.1. 6.8.2 ddrh ?data direction register for port h ddh[7:0] ?data direction for port h 1 (set) the corresponding pin is con?ured as an output. 0 (clear) the corresponding pin is con?ured as an input. pin alternative function ph7 csprog ph6 csgp2 ph5 csgp1 ph4 csio ph3 pwm4 ph2 pwm3 ph1 pwm2 ph0 pwm1 address bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 state on reset port h data (porth) $007c ph7 ph6 ph5 ph4 ph3 ph2 ph1 ph0 unde?ed address bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 state on reset data direction h (ddrh) $007d ddh7 ddh6 ddh5 ddh4 ddh3 ddh2 ddh1 ddh0 0000 0000 see section 4 for more information. see section 9 for more information. ? ? ? ? tpg 120
MC68HC11KW1 motorola 6-11 parallel input/output 6 6.9 port j port j is an 8-bit, bidirectional port, with both data and data direction registers. in addition to their i/o capabilities, ?e of port js pins are shared with timer 2 functions, as shown in the following table. 6.9.1 portj ?port j data register this is a read/write register and is not affected by reset. these bits may be read and written at any time, but, when a pin is allocated to its alternate function, a write to the corresponding register bit has no effect on the pin state. 6.9.2 ddrj ?data direction register for port j ddj[7:0] ?data direction for port j 1 (set) the corresponding pin is con?ured as an output. 0 (clear) the corresponding pin is con?ured as an input. pin alternative function pj7 c4 pj6 oc3 pj5 oc2 pj4 oc1 pj3 ecin address bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 state on reset port j data (portj) $008e pj7 pj6 pj5 pj4 pj3 pj2 pj1 pj0 unde?ed address bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 state on reset data direction j (ddrj) $008f ddj7 ddj6 ddj5 ddj4 ddj3 ddj2 ddj1 ddj0 0000 0000 see section 9 for more information. ? ? tpg 121
motorola 6-12 MC68HC11KW1 parallel input/output 6 6.10 port k port k is an 8-bit bidirectional port, with both data and data direction registers. in addition to their i/o capabilities, ?e of port ks pins are shared with timer 3 functions, as shown in the following table. 6.10.1 portk ?port k data register this is a read/write register and is not affected by reset. the bits may be read and written at any time, but, when a pin is allocated to its alternate function, a write to the corresponding register bit has no effect on the pin state. 6.10.2 ddrk ?data direction register for port k ddk[7:0] ?data direction for port k 1 (set) the corresponding pin is con?ured as an output. 0 (clear) the corresponding pin is con?ured as an input. pin alternative function pk7 c4 pk6 oc3 pk5 oc2 pk4 oc1 pk3 ecin address bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 state on reset port k data (portk) $009e pk7 pk6 pk5 pk4 pk3 pk2 pk1 pk0 unde?ed address bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 state on reset data direction k (ddrk) $009f ddk7 ddk6 ddk5 ddk4 ddk3 ddk2 ddk1 ddk0 0000 0000 see section 9 for more information. ? ? tpg 122
MC68HC11KW1 motorola 6-13 parallel input/output 6 6.11 internal pull-up resistors four of the ports (b, f, g and h) have internal, software selectable pull-up resistors under control of the port pull-up assignment register (ppar). 6.11.1 ppar ?port pull-up assignment register bits [7:4] ?not implemented; always read zero. xppue ?port x pin pull-up enable these bits control the on-chip pull-up devices connected to all the pins on i/o ports b, f, h and pg[5:0]. they are collectively enabled or disabled via the paren bit in the config register (see section 6.12.2). 1 (set) port x pin on-chip pull-up devices enabled. 0 (clear) port x pin on-chip pull-up devices disabled. note: fppue and bppue have no effect in expanded mode since ports f and b are then dedicated address bus outputs. note: hppue and gppue are set on reset, to insure that all expanded memory address signals and chip select signals will be pulled to a logic high level (since the pins are con?ured for general i/o and set as high impedance inputs). note: the pull-up resistors are disabled when the paren bit in the config register is equal to ?? the approximate value of these resistors is 14?7kohms. address bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 state on reset port pull-up assignment (ppar) $002c 0000 hppue gppue fppue bppue 0000 1111 tpg 123
motorola 6-14 MC68HC11KW1 parallel input/output 6 6.12 system con?uration one bit in each of the following registers is directly concerned with the con?uration of the i/o ports. for full details on the other bits in the registers, refer to the appropriate section. 6.12.1 opt2 ?system con?uration options register 2 lirdv ?lir driven (refer to section 4) 1 (set) enable lir drive high pulse. 0 (clear) lir not driven high on moda/lir pin. cwom ?port c wired-or mode 1 (set) port c outputs are open-drain. 0 (clear) port c operates normally. bit 5 ? not implemented; always reads zero. irvne ?internal read visibility/not e (refer to section 4) 1 (set) data from internal reads is driven out of the external data bus. 0 (clear) no visibility of internal reads on external bus. in single chip mode this bit determines whether the e clock drives out from the chip. 1 (set) e pin is driven low. 0 (clear) e clock is driven out from the chip. lsbf ?lsb ?st enable (refer to section 8) 1 (set) spi data is transferred lsb ?st. 0 (clear) spi data is transferred msb ?st. spr2 ?spi clock rate select (refer to section 8) xdv[1, 0] ?xout clock divide select (refer to section 4) these two bits control the frequency of the xclk signal, which is output on the xout pin if enabled by the clkx bit in config. address bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 state on reset system con?. options 2 (opt2) $0038 lirdv cwom 0 irvne lsbf spr2 xdv1 xdv0 000x 0000 tpg 124
MC68HC11KW1 motorola 6-15 parallel input/output 6 6.12.2 config ?system con?uration register bits [7, 6, 1] ?not implemented; always reads as one. clkx ?x clock enable (refer to section 4) 1 (set) xclk signal is driven out on the xout pin. 0 (clear) xout pin is disabled. paren ?pull-up assignment register enable 1 (set) pull-ups can be enabled using ppar register. 0 (clear) all pull-ups disabled. nosec ?eeprom security disabled (refer to section 4) 1 (set) disable security. 0 (clear) enable security. nocop ?cop system disable (refer to section 5) 1 (set) cop system disabled. 0 (clear) cop system enabled (forces reset on timeout). eeon ?eeprom enable (refer to section 4) 1 (set) eeprom is present in the memory map. 0 (clear) eeprom is disabled from the memory map. address bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 state on reset con?ur ation control (config) $003f 1 1 clkx paren nosec noco p 1 eeon 11xx xx1x tpg 125
motorola 6-16 MC68HC11KW1 parallel input/output 6 this page left blank intentionally tpg 126
MC68HC11KW1 motorola 7-1 serial communications interface 7 7 serial communications interface the serial communications interface (sci) is a universal asynchronous receiver transmitter (uart). it has a non-return to zero (nrz) format (one start, eight or nine data, and one stop bit) that is compatible with standard rs-232 systems. the sci shares i/o with two of port ds pins: the sci transmit and receive functions are enabled by te and re respectively, in sccr2. the sci features enabled on this mcu include: 13-bit modulus prescaler, idle line detect, receiver-active ?g, transmitter and receiver hardware parity. a block diagram of the enhanced baud rate generator is shown in figure 7-1. see table 7-1 for example baud rate control values. pin alternative function pd0 rxd pd1 txd figure 7-1 sci baud rate generator circuit diagram 13-bit compare sync scbdh/l : sci baud control 13-bit counter 2 internal phase 2 clock receiver baud rate clock 16 transmitter baud rate clock extal reset eq tpg 127
motorola 7-2 MC68HC11KW1 serial communications interface 7 7.1 data format the serial data format requires the following conditions: an idle-line condition before transmission or reception of a message. a start bit, logic zero, transmitted or received, that indicates the start of each character. data that is transmitted and received least signi?ant bit (lsb) ?st. a stop bit, logic one, used to indicate the end of a frame. (a frame consists of a start bit, a character of eight or nine data bits, and a stop bit.) a break (de?ed as the transmission or reception of a logic zero for some multiple number of frames). selection of the word length is controlled by the m bit of sccr1. 7.2 transmit operation the sci transmitter includes a parallel data register (scdrh/scdrl) and a serial shift register. the contents of the shift register can only be written through the parallel data register. this double buffered operation allows a character to be shifted out serially while another character is waiting in the parallel data register to be transferred into the shift register. the output of the shift register is applied to txd as long as transmission is in progress or the transmit enable (te) bit of serial communication control register 2 (sccr2) is set. the block diagram, figure 7-2, shows the transmit serial shift register and the buffer logic at the top of the ?ure. 7.3 receive operation during receive operations, the transmit sequence is reversed. the serial shift register receives data and transfers it to the parallel receive data registers (scdrh/scdrl) as a complete word. this double buffered operation allows a character to be shifted in serially while another character is still in the serial data registers. an advanced data recovery scheme distinguishes valid data from noise in the serial data stream. the data input is selectively sampled to detect receive data, and majority sampling logic determines the value and integrity of each bit. tpg 128
MC68HC11KW1 motorola 7-3 serial communications interface 7 figure 7-2 sci block diagram loops woms wake + & & & & & ? m ilt pe pt sccr1 10/11-bit tx shift register h8 l 0 7 10/11-bit rx shift register 80 7 tie tcie te rie ilie re rwu sbk sccr2 tdre tc or rdrf idle nf fe pf scsr1 raf scsr2 data recovery rxd txd scdrh/scdrl (receive buffer) r8 scdrh/scdrl (transmit buffer) t8 transmitter control receiver control loops sci interrupt request woms woms m pe pt te sbk wake pe pt re rwu m loops ilt stop start scbdl scbdh rate gener ator extal or rie rie idle ilie rdrf tc tcie tdre tie note: ? = always reads as zero flag control internal data bus tpg 129
motorola 7-4 MC68HC11KW1 serial communications interface 7 7.4 wake-up feature the wake-up feature reduces sci service overhead in multiple receiver systems. software for each receiver evaluates the ?st character or frame of each message. all receivers are placed in wake-up mode by writing a one to the rwu bit in the sccr2 register. when rwu is set, the receiver-related status ?gs (rdrf, idle, or, nf, fe, and pf) are inhibited (cannot be set). although rwu can be cleared by a software write to sccr2, to do so would be unusual. normally rwu is set by software and is cleared automatically with hardware. whenever a new message begins, logic alerts the dormant receivers to wake up and evaluate the initial character of the new message. two methods of wake-up are available: idle-line wake-up and address mark wake-up. during idle-line wake-up, a dormant receiver activates as soon as the rxd line becomes idle. in the address mark wake-up, logic one in the most signi?ant bit (msb) of a character activates all sleeping receivers. to use either receiver wake-up method, establish a software addressing scheme to allow the transmitting devices to direct messages to individual receivers or to groups of receivers. this addressing scheme can take any form as long as all transmitting and receiving devices are programmed to understand the same scheme. 7.4.1 idle-line wake-up clearing the wake bit in sccr1 register enables idle-line wake-up mode. in idle-line wake-up mode, all receivers are active (rwu bit in sccr2 = 0) when each message begins. the ?st frames of each message are addressing frames. each receiver in the system evaluates the addressing frames of a message to determine if the message is intended for that receiver. when a receiver ?ds that the message is not intended for it, it sets the rwu bit. once set, the rwu control bit disables all but the necessary receivers for the remainder of the message, thus reducing software overhead for the remainder of that message. as soon as an idle line is detected by receiver logic, hardware automatically clears the rwu bit so that the ?st frames of the next message can be evaluated by all receivers in the system. this type of receiver wake-up requires a minimum of one idle frame time between messages, and no idle time between frames within a message. 7.4.2 address-mark wake-up setting the wake bit in sccr1 register enables address-mark wake-up mode. the address-mark wake-up method uses the msb of each frame to differentiate between address information (msb = 1) and actual message data (msb = 0). all frames consist of seven information bits (eight bits if m bit in sccr1 = 1) and an msb which, when set to one, indicates an address frame. the ?st frames of each message are addressing frames. receiver logic evaluates these marked frames to determine the receivers for which that message is intended. when a receiver ?ds that the message is not intended for it, it sets the rwu bit. once set, the rwu control bit disables all but the necessary receivers for the remainder of the message, thus reducing software overhead tpg 130
MC68HC11KW1 motorola 7-5 serial communications interface 7 for the remainder of that message. when the next message begins, its ?st frame will have the msb set which will automatically clear the rwu bit and indicate that this is an addressing frame. this frame is always the ?st frame received after wake-up because the rwu bit is cleared before the stop bit for the ?st frame is received. this method of wake-up allows messages to include idle times, however, there is a loss in ef?iency due to the extra bit time required for the address bit in each frame. 7.5 sci error detection four error conditions can occur during sci operation. these error conditions are: serial data register overrun, received bit noise, framing, and parity error. four bits (or, nf, fe, and pf) in serial communications status register 1 (scsr1) indicate if one of these error conditions exists. the overrun error (or) bit is set when the next byte is ready to be transferred from the receive shift register to the serial data registers (scdrh/scdrl) and the registers are already full (rdrf bit is set). when an overrun error occurs, the data that caused the overrun is lost and the data that was already in serial data registers is not disturbed. the or is cleared when the scsr is read (with or set), followed by a read of the sci data registers. the noise ?g (nf) bit is set if there is noise on any of the received bits, including the start and stop bits. the nf bit is not set until the rdrf ?g is set. the nf bit is cleared when the scsr is read (with fe equal to one) followed by a read of the sci data registers. when no stop bit is detected in the received data character, the framing error (fe) bit is set. fe is set at the same time as the rdrf. if the byte received causes both framing and overrun errors, the processor only recognizes the overrun error. the framing error ?g inhibits further transfer of data into the sci data registers until it is cleared. the fe bit is cleared when the scsr is read (with fe equal to one) followed by a read of the sci data registers. the parity error ?g (pf) is set if received data has incorrect parity. the ?g is cleared by a read of scsr1 with pe set, followed by a read of scdr. 7.6 sci registers there are eight addressable registers in the sci. scbdh, scbdl, sccr1 and sccr2 are control registers. the contents of these registers control functions and indicate conditions within the sci. the status registers scsr1 and scsr2 contain bits that indicate certain conditions within the sci. scdrh and scdrl are sci data registers. these double buffered registers are used for the transmission and reception of data, and are used to form the 9-bit data word for the sci. if the sci is being used with 7 or 8-bit data, only scdrl needs to be accessed. note that if 9-bit data format is used, the upper register should be written ?st to ensure that it is transferred to the transmitter shift register with the lower register. tpg 131
motorola 7-6 MC68HC11KW1 serial communications interface 7 7.6.1 scbdh, scbdl ?sci baud rate control registers the contents of this register determine the baud rate of the sci. btst ?baud register test (test mode only) bspl ?baud rate counter split (test mode only) sync ?baud rate counter reset and sync (test mode only) sbr[12:0] ?sci baud rate selects use the following formula to calculate sci baud rate. refer to the table of baud rate control values for example rates: where the baud rate control value (br) is the contents of scbdh/l (br = 1, 2, 3,... 8191). for example, to obtain a baud rate of 1200 with an extal frequency of 16 mhz, the baud register (scbdh/l) should contain $01a0 (see table 7-1). the clock rate generator is disabled if br = 0, or if neither the receiver nor transmitter is enabled (both re and te in sccr2 are cleared). writes to the baud rate registers will only be successful if the last (or only) byte written is scbdl. the use of an std instruction is recommended as it guarantees that the bytes are written in the correct order. address bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 state on reset sci baud rate high (scbdh) $0070 btst bspl sync sbr12 sbr11 sbr10 sbr9 sbr8 0000 0000 sci baud r ate low (scbdl) $0071 sbr7 sbr6 sbr5 sbr4 sbr3 sbr2 sbr1 sbr0 0000 0100 sci baud rate extal 16 2br () ----------------------------- - = tpg 132
MC68HC11KW1 motorola 7-7 serial communications interface 7 7.6.2 sccr1 ?sci control register 1 the sccr1 register provides the control bits that determine word length and select the method used for the wake-up feature. loops ?sci loop mode enable 1 (set) sci transmit and receive are disconnected from txd and rxd pins, and transmitter output is fed back into the receiver input. 0 (clear) sci transmit and receive operate normally. both the transmitter and receiver must be enabled to use the loop mode. when the loop mode is enabled, the txd pin is driven high (idle line state) if the transmitter is enabled. woms ?wired-or mode for sci pins (pd1, pd0) 1 (set) txd and rxd are open drains if operating as outputs. 0 (clear) txd and rxd operate normally. bit 5 ?not implemented; always reads zero m ?mode (select character format) 1 (set) start bit, 9 data bits, 1 stop bit. 0 (clear) start bit, 8 data bits, 1 stop bit. table 7-1 example sci baud rate control values target baud rate extal frequency: 16 mhz dec value hex value 110 4545 $11c1 150 3333 $0d05 300 1666 $0682 600 833 $0341 1200 416 $01a0 2400 208 $00d0 4800 104 $0068 9600 52 $0034 19200 26 $001a 38400 13 $000d address bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 state on reset sci control 1 (sccr1) $0072 loops woms 0 m wake ilt pe pt 0000 0000 tpg 133
motorola 7-8 MC68HC11KW1 serial communications interface 7 wake ?wake-up by address mark/idle 1 (set) wake-up by address mark (most signi?ant data bit set). 0 (clear) wake-up by idle line recognition. ilt ?idle line type 1 (set) long (sci counts ones only after stop bit). 0 (clear) short (sci counts consecutive ones after start bit). this bit determines which of two types of idle line detection method is used by the sci receiver. in short mode the stop bit and any bits that were ones before the stop bit will be considered as part of that string of ones, possibly resulting in erroneous or premature detection of an idle line condition. in long mode the sci system does not begin counting ones until a stop bit is received. pe ?parity enable 1 (set) parity enabled. 0 (clear) parity disabled. pt ?parity type 1 (set) parity odd (an odd number of ones causes parity bit to be zero, an even number of ones causes parity bit to be one). 0 (clear) parity even (an even number of ones causes parity bit to be zero, an odd number of ones causes parity bit to be one). tpg 134
MC68HC11KW1 motorola 7-9 serial communications interface 7 7.6.3 sccr2 ?sci control register 2 the sccr2 register provides the control bits that enable or disable individual sci functions. tie ?transmit interrupt enable 1 (set) sci interrupt requested when tdre status ?g is set. 0 (clear) tdre interrupts disabled. tcie ?transmit complete interrupt enable 1 (set) sci interrupt requested when tc status ?g is set. 0 (clear) tc interrupts disabled. rie ?receiver interrupt enable 1 (set) sci interrupt requested when rdrf ?g or the or status ?g is set. 0 (clear) rdrf and or interrupts disabled. ilie ?idle line interrupt enable 1 (set) sci interrupt requested when idle status ?g is set. 0 (clear) idle interrupts disabled. te ?transmitter enable 1 (set) transmitter enabled. 0 (clear) transmitter disabled. re ?receiver enable 1 (set) receiver enabled. 0 (clear) receiver disabled. rwu ?receiver wake-up control 1 (set) wake-up enabled and receiver interrupts inhibited. 0 (clear) normal sci receiver. sbk ?send break 1 (set) break codes generated as long as sbk is set. 0 (clear) break generator off. address bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 state on reset sci control 2 (sccr2) $0073 tie tcie rie ilie te re rwu sbk 0000 0000 tpg 135
motorola 7-10 MC68HC11KW1 serial communications interface 7 7.6.4 scsr1 ?sci status register 1 the bits in scsr1 indicate certain conditions in the sci hardware and are automatically cleared by special acknowledge sequences. tdre ?transmit data register empty ?g 1 (set) scdr empty. 0 (clear) scdr busy. this ?g is set when scdr is empty. clear the tdre ?g by reading scsr1 with tdre set and then writing to scdr. tc ?transmit complete ?g 1 (set) transmitter idle. 0 (clear) transmitter busy. this ?g is set when the transmitter is idle (no data, preamble, or break transmission in progress). clear the tc ?g by reading scsr1 with tc set and then writing to scdr. rdrf ?receive data register full ?g 1 (set) scdr full. 0 (clear) scdr empty. once cleared, idle is not set again until the rxd line has been active and becomes idle again. rdrf is set if a received character is ready to be read from scdr. clear the rdrf ?g by reading scsr1 with rdrf set and then reading scdr. idle ?idle line detected ?g 1 (set) rxd line is idle. 0 (clear) rxd line is active. this ?g is set if the rxd line is idle. once cleared, idle is not set again until the rxd line has been active and becomes idle again. the idle ?g is inhibited when rwu = 1. clear idle by reading scsr1 with idle set and then reading scdr. address bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 state on reset sci status 1 (scsr1) $0074 tdre tc rdrf idle or nf fe pf 1100 0000 tpg 136
MC68HC11KW1 motorola 7-11 serial communications interface 7 or ?overrun error ?g 1 (set) overrun detected. 0 (clear) no overrun. or is set if a new character is received before a previously received character is read from scdr. clear the or ?g by reading scsr1 with or set and then reading scdr. nf ?noise error ?g 1 (set) noise detected. 0 (clear) unanimous decision. nf is set if the majority sample logic detects anything other than a unanimous decision. clear nf by reading scsr1 with nf set and then reading scdr. fe ?framing error 1 (set) zero detected. 0 (clear) stop bit detected. fe is set when a zero is detected where a stop bit was expected. clear the fe ?g by reading scsr1 with fe set and then reading scdr. pf ?parity error ?g 1 (set) incorrect parity detected. 0 (clear) parity correct. pf is set if received data has incorrect parity. clear pf by reading scsr1 with pe set and then reading scdr. 7.6.5 scsr2 ?sci status register 2 in the scsr2 only bit 0 is used, to indicate receiver active. the other seven bits always read zero. bits [7:1] ?not implemented; always read zero raf ?receiver active ?g (read only) 1 (set) a character is being received. 0 (clear) a character is not being received. address bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 state on reset sci status 2 (scsr2) $0075 0000000raf 0000 0000 tpg 137
motorola 7-12 MC68HC11KW1 serial communications interface 7 7.6.6 scdrh, scdrl ?sci data high/low registers scdrh/scdrl is a parallel register that performs two functions. it is the receive data register when it is read, and the transmit data register when it is written. reads access the receive data buffer and writes access the transmit data buffer. data received or transmitted is double buffered. if the sci is being used with 7 or 8-bit data, only scdrl needs to be accessed. note that if 9-bit data format is used, the upper register should be written ?st to ensure that it is transferred to the transmitter shift register with the lower register. r8 ?receiver bit 8 ninth serial data bit received when sci is con?ured for a nine data bit operation t8 ?transmitter bit 8 ninth serial data bit transmitted when sci is con?ured for a nine data bit operation bits [5:0] ?not implemented; always read zero r/t[7:0] ?receiver/transmitter data bits [7:0] sci data is double buffered in both directions. 7.7 status ?gs and interrupts the sci transmitter has two status ?gs. these status ?gs can be read by software (polled) to tell when certain conditions exist. alternatively, a local interrupt enable bit can be set to enable each of these status conditions to generate interrupt requests. status ?gs are automatically set by hardware logic conditions, but must be cleared by software. this provides an interlock mechanism that enables logic to know when software has noticed the status indication. the software clearing sequence for these ?gs is automatic ?functions that are normally performed in response to the status ?gs also satisfy the conditions of the clearing sequence. tdre and tc ?gs are normally set when the transmitter is ?st enabled (te set to one). the tdre ?g indicates there is room in the transmit queue to store another data character in the transmit data register. the tie bit is the local interrupt mask for tdre. when tie is zero, tdre must be polled. when tie and tdre are one, an interrupt is requested. address bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 state on reset sci data high (scdrh) $0076 r8 t8 000000 unde?ed sci data low (scdrl) $0077 r7t7 r6t6 r5t5 r4t4 r3t3 r2t2 r1t1 r0t0 unde?ed tpg 138
MC68HC11KW1 motorola 7-13 serial communications interface 7 the tc ?g indicates the transmitter has completed the queue. the tcie bit is the local interrupt mask for tc. when tcie is zero, tc must be polled; when tcie is one and tc is one, an interrupt is requested. writing a zero to te requests that the transmitter stop when it can. the transmitter completes any transmission in progress before shutting down. only an mcu reset can cause the transmitter to stop and shut down immediately. if te is cleared when the transmitter is already idle, the pin reverts to its general purpose i/o function (synchronized to the bit-rate clock). if anything is being transmitted when te is cleared, that character is completed before the pin reverts to general purpose i/o, but any other characters waiting in the transmit queue are lost. the tc and tdre ?gs are set at the completion of this last character, even though te has been disabled. 7.7.1 receiver ?gs the sci receiver has seven status ?gs, three of which can generate interrupt requests. the status ?gs are set by the sci logic in response to speci? conditions in the receiver. these ?gs can be read (polled) at any time by software. refer to figure 7-3, which shows sci interrupt arbitration. when an overrun takes place, the new character is lost, and the character that was in its way in the parallel receive data register (rdr) is undisturbed. rdrf is set when a character has been received and transferred into the parallel rdr. the or ?g is set instead of rdrf if overrun occurs. a new character is ready to be transferred into the rdr before a previous character is read from the rdr. the nf, fe and pf ?gs provide additional information about the character in the rdr, but do not generate interrupt requests. the receiver active ?g (raf) indicates that the receiver is busy. the last receiver status ?g and interrupt source come from the idle ?g. the rxd line is idle if it has constantly been at logic one for a full character time. the idle ?g is set only after the rxd line has been busy and becomes idle. this prevents repeated interrupts for the time rxd remains idle. tpg 139
motorola 7-14 MC68HC11KW1 serial communications interface 7 figure 7-3 interrupt source resolution within sci no begin rdrf = 1? or = 1? tdre = 1? tc = 1? idle = 1? no valid sci interr upt request rie = 1? te = 1? re = 1? tie = 1? tcie = 1? ilie = 1? re = 1? valid sci interr upt request yes yes yes yes yes yes yes yes yes yes yes yes no no no no no no no no no no no tpg 140
MC68HC11KW1 motorola 8-1 serial peripheral interface 8 8 serial peripheral interface the serial peripheral interface (spi), an independent serial communications subsystem, allows the mcu to communicate synchronously with peripheral devices, such as transistor-transistor logic (ttl) shift registers, liquid crystal (lcd) display drivers, analog-to-digital converter subsystems, and other microprocessors. the spi is also capable of inter-processor communication in a multiple master system. the spi system can be con?ured as either a master or a slave device, with data rates as high as one half of the e clock rate when con?ured as a master and as fast as the e clock rate when con?ured as a slave. the spi shares i/o with four of port ds pins and is enabled by spe in the spcr. 8.1 functional description the central element in the spi system is the block containing the shift register and the read data buffer (see figure 8-1). the system is single buffered in the transmit direction and double buffered in the receive direction. this means that new data for transmission cannot be written to the shifter until the previous transfer is complete; however, received data is transferred into a parallel read data buffer so the shifter is free to accept a second serial character. as long as the ?st character is read out of the read data buffer before the next serial character is ready to be transferred, no overrun condition occurs. a single mcu register address is used for reading data from the read data buffer and for writing data to the shifter. the spi status block represents the spi status functions (transfer complete, write collision, and mode fault) performed by the serial peripheral status register (spsr). the spi control block represents those functions that control the spi system through the serial peripheral control register (spcr). pin alternative function pd2 miso pd3 mosi pd4 sck pd5 ss tpg 141
motorola 8-2 MC68HC11KW1 serial peripheral interface 8 8.2 spi transfer formats during an spi transfer, data is simultaneously transmitted and received. a serial clock line synchronizes shifting and sampling of the information on the two serial data lines. a slave select line allows individual selection of a slave spi device; slave devices that are not selected do not interfere with spi bus activities. on a master spi device, the select line can optionally be used to indicate a multiple master bus contention. refer to figure 8-2. figure 8-1 spi block diagram spcr ?spi control register spsr ?spi status register divider spdr ?spi data register shift control logic read data buffer 8-bit shift register opt2 ?options register 2 2 4 8 ?6 ?2 ?4 ?28 select clock logic spi control miso pd2 mosi pd3 sck pd4 ss pd5 s m s m s m pin control logic mcu system clock spie spe dwom mstr cpol cpha spr1 spr0 spif wcol modf lsbf spr2 mstr spe dwom mstr spe spie lsbf clock spi clock (master) spi interrupt request internal bus tpg 142
MC68HC11KW1 motorola 8-3 serial peripheral interface 8 8.2.1 clock phase and polarity controls software can select one of four combinations of serial clock phase and polarity using two bits in the spi control register (spcr). the clock polarity is speci?d by the cpol control bit, which selects an active high or active low clock, and has no signi?ant effect on the transfer format. the clock phase (cpha) control bit selects one of two different transfer formats. the clock phase and polarity should be identical for the master spi device and the communicating slave device. in some cases, the phase and polarity are changed between transfers to allow a master device to communicate with peripheral slaves having different requirements. when cpha equals zero, the ss line must be deasserted and reasserted between each successive serial byte. also, if the slave writes data to the spi data register (spdr) while ss is low, a write collision error results. when cpha equals one, the ss line can remain low between successive transfers. 8.3 spi signals the following paragraphs contain descriptions of the four spi signals: master in slave out (miso), master out slave in (mosi), serial clock (sck), and slave select (ss ). any spi output line must have its corresponding data direction bit in ddrd register set. if the ddr bit is clear, that line is disconnected from the spi logic and becomes a general-purpose input. all spi input lines are forced to act as inputs regardless of the state of the corresponding ddr bits in ddrd register. figure 8-2 spi transfer format 1 2 3 4 5 6 7 8 msb654321lsb msb654321 lsb sck cycle # (for reference) sck (cpol=0) sck (cpol=1) sample input data out (cpha=0) sample input data out (cpha=1) ss (to slave) note: this f igure shows the lsbf=0 (default) case. if lsbf=1, data is tr ansf erred in the reverse order (lsb f irst). tpg 143
motorola 8-4 MC68HC11KW1 serial peripheral interface 8 8.3.1 master in slave out miso is one of two unidirectional serial data signals. it is an input to a master device and an output from a slave device. the miso line of a slave device is placed in the high-impedance state if the slave device is not selected. 8.3.2 master out slave in the mosi line is the second of the two unidirectional serial data signals. it is an output from a master device and an input to a slave device. the master device places data on the mosi line a half-cycle before the clock edge that the slave device uses to latch the data. 8.3.3 serial clock sck, an input to a slave device, is generated by the master device and synchronizes data movement in and out of the device through the mosi and miso lines. master and slave devices are capable of exchanging a byte of information during a sequence of eight clock cycles. there are four possible timing relationships that can be chosen by using control bits cpol and cpha in the serial peripheral control register (spcr). both master and slave devices must operate with the same timing. the spi clock rate select bits, spr[1:0], in the spcr of the master device, select the clock rate. in a slave device, spr[1:0] have no effect on the operation of the spi. 8.3.4 slave select the slave select ss input of a slave device must be externally asserted before a master device can exchange data with the slave device. ss must be low before data transactions begin and must stay low for the duration of the transaction. the ss line of the master must be held high. if it goes low, a mode fault error ?g (modf) is set in the serial peripheral status register (spsr). to disable the mode fault circuit, write a one in bit 5 of the port d data direction register. this sets the ss pin to act as a general-purpose output, rather than a dedicated input to the slave select circuit, thus inhibiting the mode fault ?g. the other three lines are dedicated to the spi whenever the serial peripheral interface is on. the state of the master and slave cpha bits affects the operation of ss . cpha settings should be identical for master and slave. when cpha = 0, the shift clock is the or of ss with sck. in this clock phase mode, ss must go high between successive characters in an spi message. when cpha = 1, ss can be left low between successive spi characters. in cases where there is only one spi slave mcu, its ss line can be tied to v ss as long as only cpha = 1 clock mode is used. tpg 144
MC68HC11KW1 motorola 8-5 serial peripheral interface 8 8.4 spi system errors two kinds of system errors can be detected by the spi system. the ?st type of error arises in a multiple-master system when more than one spi device simultaneously tries to be a master. this error is called a mode fault. the second type of error, write collision, indicates that an attempt was made to write data to the spdr while a transfer was in progress. when the spi system is con?ured as a master and the ss input line goes to active low, a mode fault error has occurred ?usually because two devices have attempted to act as master at the same time. in the case where more than one device is concurrently con?ured as a master, there is a chance of contention between two pin drivers. for push-pull cmos drivers, this contention can cause permanent damage. the mode fault detection circuitry attempts to protect the device by disabling the drivers. the mstr control bit in the spcr and all four ddrd control bits associated with the spi are cleared and an interrupt is generated (subject to masking by the spie control bit and the i bit in the ccr). other precautions may need to be taken to prevent driver damage. if two devices are made masters at the same time, the mode fault detector does not help protect either one unless one of them selects the other as slave. the amount of damage possible depends on the length of time both devices attempt to act as master. a write collision error occurs if the spdr is written while a transfer is in progress. because the spdr is not double buffered in the transmit direction, writes to spdr cause data to be written directly into the spi shift register. because this write corrupts any transfer in progress, a write collision error is generated. the transfer continues undisturbed, and the write data that caused the error is not written to the shifter. a write collision is normally a slave error because a slave has no control over when a master initiates a transfer. a master knows when a transfer is in progress, so there is no reason for a master to generate a write-collision error, although the spi logic can detect write collisions in both master and slave devices. the spi con?uration determines the characteristics of a transfer in progress. for a master, a transfer begins when data is written to spdr and ends when spif is set. for a slave with cpha equal to zero, a transfer starts when ss goes low and ends when ss returns high. in this case, spif is set at the middle of the eighth sck cycle when data is transferred from the shifter to the parallel data register, but the transfer is still in progress until ss goes high. for a slave with cpha equal to one, transfer begins when the sck line goes to its active level, which is the edge at the beginning of the ?st sck cycle. the transfer ends when spif is set, for a slave in which cpha=1. 8.5 spi registers the three spi registers, spcr, spsr, and spdr, provide control, status, and data storage functions. refer to the following information for a description of how these registers are organized. tpg 145
motorola 8-6 MC68HC11KW1 serial peripheral interface 8 8.5.1 spcr ?spi control register this register can be read and written at any time. spie ?serial peripheral interrupt enable 1 (set) a hardware interrupt sequence is requested each time spif or modf is set. 0 (clear) spi interrupts are inhibited. set the spie bit to a one to request a hardware interrupt sequence each time the spif or modf status ?g is set. spi interrupts are inhibited if this bit is clear or if the i bit in the condition code register is one. spe ?serial peripheral system enable 1 (set) port d [5:2] is dedicated to the spi. 0 (clear) port d has its default i/o functions and the clock generator is stopped. when the spe bit is set, the port d pins 2, 3, 4, and 5 are dedicated to the spi functions and lose their general purpose i/o functions. when the spi system is enabled and expects any of pd[4:2] to be inputs then those pins will be inputs regardless of the state of the associated ddrd bits. if any of pd[4:2] are expected to be outputs then those pins will be outputs only if the associated ddrd bits are set. however, if the spi is in the master mode, ddd5 determines whether pd5 is an error detect input (ddd5 = 0) or a general-purpose output (ddd5 = 1). dwom ?port d wired-or mode 1 (set) port d [5:2] buffers con?ured for open-drain outputs. 0 (clear) port d [5:2] buffers con?ured for normal cmos outputs. mstr ?master mode select 1 (set) master mode 0 (clear) slave mode address bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 state on reset spi control (spcr) $0028 spie spe dwom mstr cpol cpha spr1 spr0 0000 01uu tpg 146
MC68HC11KW1 motorola 8-7 serial peripheral interface 8 cpol ?clock polarity 1 (set) sck is active low. 0 (clear) sck is active high. when the clock polarity bit is cleared and data is not being transferred, the sck pin of the master device has a steady state low value. when cpol is set, sck idles high. refer to figure 8-2 and section 8.2.1. cpha ?clock phase the clock phase bit, in conjunction with the cpol bit, controls the clock-data relationship between master and slave. the cpha bit selects one of two different clocking protocols. refer to figure 8-2 and section 8.2.1. spr1 and spr0 ?spi clock rate selects these two bits select the spi clock rate, as shown in table 8-1. note that spr2 is located in the opt2 register, and that its state on reset is zero. table 8-1 spi clock rates spr[2:0] e clock divide ratio spi clock frequency ( o baud rate) for: e = 4mhz 0 0 0 2 2.0 mhz 0 0 1 4 1.0 mhz 0 1 0 16 250 khz 0 1 1 32 125 khz 1 0 0 8 500 khz 1 0 1 16 250 khz 1 1 0 64 62.5 khz 1 1 1 128 31.3 khz tpg 147
motorola 8-8 MC68HC11KW1 serial peripheral interface 8 8.5.2 spsr ?spi status register this register can be read at any time, but writing to it has no effect. spif ?spi interrupt complete ?g 1 (set) data transfer to external device has been completed. 0 (clear) no valid completion of data transfer. spif is set upon completion of data transfer between the processor and the external device. if spif goes high, and if spie is set, a serial peripheral interrupt is generated. to clear the spif bit, read the spsr with spif set, then access the spdr. unless spsr is read (with spif set) ?st, attempts to write spdr are inhibited. wcol ?write collision 1 (set) write collision. 0 (clear) no write collision. clearing the wcol bit is accomplished by reading the spsr (with wcol set) followed by an access of spdr. refer to section 8.3.4 and section 8.4. modf ?mode fault 1 (set) mode fault. 0 (clear) no mode fault. to clear the modf bit, read the spsr (with modf set), then write to the spcr. refer to section 8.3.4 and section 8.4. bits [5, 3:0] ? not implemented; always read zero. address bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 state on reset spi status (spsr) $0029 spif wcol 0 modf 0000 0000 0000 tpg 148
MC68HC11KW1 motorola 8-9 serial peripheral interface 8 8.5.3 spdr ?spi data register the spdr is used when transmitting or receiving data on the serial bus. only a write to this register initiates transmission or reception of a byte, and this only occurs in the master device. at the completion of transferring a byte of data, the spif status bit is set in both the master and slave devices. a read of the spdr is actually a read of a buffer. to prevent an overrun and the loss of the byte that caused the overrun, the ?st spif must be cleared by the time a second transfer of data from the shift register to the read buffer is initiated. spi is double buffered in and single buffered out. 8.5.4 opt2 ?system con?uration options register 2 lirdv ?lir driven (refer to section 4) 1 (set) enable lir drive high pulse. 0 (clear) lir not driven high on moda/lir pin. cwom ?port c wired-or mode (refer to section 6) 1 (set) port c outputs are open-drain. 0 (clear) port c operates normally. bit 5 ? not implemented; always reads zero. irvne ?internal read visibility/not e (refer to section 4) 1 (set) data from internal reads is driven out of the external data bus. 0 (clear) no visibility of internal reads on external bus. in single chip mode this bit determines whether the e clock drives out from the chip. 1 (set) e pin is driven low. 0 (clear) e clock is driven out from the chip. address bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 state on reset spi data (spdr) $002a (bit 7) (6) (5) (4) (3) (2) (1) (bit 0) unde?ed address bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 state on reset system con?. options 2 (opt2) $0038 lirdv cwom 0 irvne lsbf spr2 xdv1 xdv0 000x 0000 tpg 149
motorola 8-10 MC68HC11KW1 serial peripheral interface 8 lsbf ?lsb ?st enable 1 (set) spi data is transferred lsb ?st. 0 (clear) spi data is transferred msb ?st. if this bit is set, data, which is usually transferred msb ?st, is transferred lsb ?st. lsbf does not affect the position of the msb and lsb in the data register. reads and writes of the data register always have msb in bit 7. spr2 ?spi clock rate select when set, spr2 adds a divide-by-4 prescaler to the spi clock chain. with the two bits in the spcr, this bit speci?s the spi clock rate. refer to table 8-1. xdv[1, 0] ?xout clock divide select (refer to section 4) these two bits control the frequency of the xclk signal, which is output on the xout pin if enabled by the clkx bit in config. tpg 150
MC68HC11KW1 motorola 9-1 timing system 9 9 timing system the MC68HC11KW1 contains three 16-bit timers. figure 9-1 provides a diagram of the entire timing system. the main timer, timer 1, is described in the following paragraphs; refer to section 9.2 and section 9.3 for descriptions of timer 2 and timer 3. 9.1 timer 1 timer 1 is the standard m68hc11 timing system, composed of several clock divider chains. the main clock divider chain includes a 16-bit free-running counter, driven by a programmable prescaler. the prescaler output divides the system clock by 1, 4, 8, or 16. taps from this main clocking chain drive-circuitry generate the slower clocks used by the pulse accumulator, the real-time interrupt (rti), and the computer operating properly (cop) watchdog subsystems, which are also described in this section. refer to figure 9-1. all main timer system activities are referenced to this free-running counter. the counter begins incrementing from $0000 as the mcu comes out of reset, and continues to the maximum count, $ffff. at the maximum count, the counter rolls over to $0000, sets an over?w ?g and continues to increment. as long as the mcu is running in a normal operating mode, there is no way to reset, change or interrupt the counting. the capture/compare subsystem features three input capture channels, four output compare channels and one channel that can be selected to perform either input capture or output compare. each of the three input capture functions has its own 16-bit input capture register (time capture latch) and each of the output compare functions has its own 16-bit compare register. all timer functions, including the timer over?w and rti, have their own interrupt controls and separate interrupt vectors. the pulse accumulator contains an 8-bit counter and edge select logic. the pulse accumulator can operate in either event counting mode or gated time accumulation mode. during event counting mode, the pulse accumulators 8-bit counter increments when a speci?d edge is detected on an input signal. during gated time accumulation mode, an internal clock source increments the 8-bit counter while an input signal has a predetermined logic level. the real-time interrupt (rti) is a programmable periodic interrupt circuit that permits pacing the execution of software routines by selecting one of four interrupt rates. tpg 151
motorola 9-2 MC68HC11KW1 timing system 9 figure 9-1 timer clock divider chains ?2 6 set q q reset ff2 set q q reset ff1 + baud 1, 2, 3, 4,? 8191 sci receiver clock sci transmitter clock e clock prescaler 2, 4, 8,16, 32, 64, 128 spr[2:0] spi pulse accum ulator prescaler 1, 2, 4, 8 rtr[1:0] real time interrupt tcnt1 t1of prescaler 1, 4, 16, 64 cr[1:0] system reset clear cop timer force cop ic/oc 4 16 internal bus clock crystal oscillator 2 2 3 prescaler 1, 4, 8, 16 pr[1:0] extal sbr[12:0] a/d and memory) (baud rate) ?2 12 ph2 (for cpu, pwm, reset clock eceb, ecea configuration prescaler 1, 4, 8, 16 pr2b, pr2a tcnt2 ecin pk7/ t3of ic/oc tcnt3 prescaler 1, 4, 16, or use pr3b, pr3a clock eceb, ecea configuration ecin pj7/ t2of ic/oc timer 1 rate tpg 152
MC68HC11KW1 motorola 9-3 timing system 9 the cop watchdog clock input (e/2 15 ) is tapped off from the free-running counter chain. the cop automatically times out unless it is serviced within a speci? time by a program reset sequence. if the cop is allowed to time out, a reset is generated, which drives the reset pin low to reset the mcu and the external system. refer to table 9-1 for crystal related frequencies and periods. 9.1.1 timer 1 structure the functions of timer 1 share i/o with the pins of port a as follows: figure 9-3 shows the timer 1 capture/compare system block diagram. the port a pin control block includes logic for timer functions and for general-purpose i/o. for pins pa3, pa2, pa1 and pa0, this block contains both the edge-detection logic and the control logic that enables the selection of which edge triggers an input capture. the digital level on pa[3:0] can be read at any time (read porta register), even if the pin is being used for the input capture function. pins pa[6:3] are used either for general-purpose i/o, or as output compare pins. when one of these pins is being used for an output compare function, it cannot be written directly as if it were a general-purpose output. each of the output compare functions (oc[5:2]) is related to one of the port a output pins. output table 9-1 timer 1 resolution and capacity clock 16.0mhz 4e xtal control bits pr[1:0] 4.0mhz e e clock 250 ns 1/e period 0 0 250ns 16.384ms 1/e 2 16 /e ?resolution ?over?w 0 1 1.0s 65.536ms 4/e 2 18 /e ?resolution ?over?w 1 0 2.0s 131.07ms 8/e 2 19 /e ?resolution ?over?w 1 1 4.0s 262.14ms 16/e 2 20 /e ?resolution ?over?w pin alternative function pa0 ic3 pa1 ic2 pa2 ic1 pa3 oc5 and/or oc1, or ic4 pa4 oc4 and/or oc1 pa5 oc3 and/or oc1 pa6 oc2 and/or oc1 pa7 pai and/or oc1 tpg 153
motorola 9-4 MC68HC11KW1 timing system 9 compare 1 (oc1) has extra control logic, allowing it optional control of any combination of the pa[7:3] pins. the pa7 pin can be used as a general-purpose i/o pin, as an input to the pulse accumulator or as an oc1 output pin. 9.1.2 input capture the input capture function records the time an external event occurs by latching the value of the free-running counter when a selected edge is detected at the associated timer input pin. software can store latched values and use them to compute the periodicity and duration of events. for example, by storing the times of successive edges of an incoming signal, software can determine the period and pulse width of a signal. to measure period, two successive edges of the same polarity are captured. to measure pulse width, two alternate polarity edges are captured. in most cases, input capture edges are asynchronous with respect to the internal timer counter, which is clocked relative to an internal clock (ph2). these asynchronous capture requests are synchronized with ph2 so that latching occurs on the opposite half cycle of ph2 from when the timer counter is being incremented. this synchronization process introduces a delay from when the edge occurs to when the counter value is detected. because these delays cancel out when the time between two edges is being measured, the delay can be ignored. when an input capture is being used with an output compare, there is a similar delay between the actual compare point and when the output pin changes state. the control and status bits that implement the input capture functions are contained in the pactl, tctl2, tmsk1, and tflg1 registers. to con?ure port a bit 3 as an input capture, clear the dda3 bit of the ddra register. note that this bit is cleared out of reset. to enable pa3 as the fourth input capture, set the i4/o5 bit in the pactl register. otherwise, pa3 is con?ured as a ?th output compare out of reset, with bit i4/o5 being cleared. if the dda3 bit is set (con?uring pa3 as an output), and ic4 is enabled, then writes to pa3 cause edges on the pin to result in input captures. writing to ti4/o5 has no effect when the ti4/o5 register is acting as ic4. tpg 154
MC68HC11KW1 motorola 9-5 timing system 9 figure 9-2 timer 1 capture/compare block diagram + & prescaler 1, 4, 8, 16 pr[1:0] mcu e clock 16-bit free r unning counter tcnt (hi) tcnt (lo) toc1 (lo) & 9 toc1 (hi) 16-bit comparator eq toc2 (lo) toc2 (hi) 16-bit comparator eq toc3 (lo) toc3 (hi) 16-bit comparator eq toc4 (lo) toc4 (hi) 16-bit comparator eq ti4/o5 (lo) ti4/o5 (hi) 16-bit comparator eq tic1 (lo) tic1 (hi) tic2 (lo) tic2 (hi) tic3 (lo) tic3 (hi) 16-bit timer bus 16-bit latch clk 16-bit latch clk 16-bit latch clk 16-bit latch clk oc1f tof toi i4/o5f 8 oc2f oc3f oc4f ic1f ic2f ic3f i4/o5 oc5 ic4 oc1i foc1 bit 7 + & 7 oc2i foc2 + & 6 oc3i foc3 + & 5 oc4i foc4 + & 4 i4/o5i foc5 & ic1i 3 & ic3i 1 & ic2i 2 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 pa6/ oc2/ oc1 pa5/ oc3/ oc1 pa4/ oc4/ oc1 pa3/ oc5/ oc1/ pa2/ ic1 ic4 pa1/ ic2 pa0/ ic3 tflg1 status flags tmsk1 interrupt enables port a pin control port a pin actions are controlled by oc1m, oc1d, pa ctl, tctl1 and tctl2 registers pins/ functions cforc force o/p compare to pulse accum ulator taps for r ti, cop and pa note ? ? interrupt requests 1? (these are further qualified by the i-bit in the ccr) pa7/ oc1/ pai tpg 155
motorola 9-6 MC68HC11KW1 timing system 9 9.1.2.1 tctl2 ?timer control register 2 use the control bits of this register to program input capture functions to detect a particular edge polarity on the corresponding timer input pin. each of the input capture functions can be independently con?ured to detect rising edges only, falling edges only, any edge (rising or falling), or to disable the input capture function. the input capture functions operate independently of each other and can capture the same tcnt value if the input edges are detected within the same timer count cycle. edgxb and edgxa ?input capture edge control there are four pairs of these bits. each pair is cleared by reset and must be encoded to con?ure the corresponding input capture edge detector circuit. ic4 functions only if the i4/o5 bit in the pactl register is set. address bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 state on reset timer control 2 (tctl2) $0021 edg4b edg4a edg1b edg1a edg2b edg2a edg3b edg3a 0000 0000 edgxb edgxa con guration 0 0 icx disabled 0 1 icx captures on rising edges only 1 0 icx captures on falling edges only 1 1 icx captures on any edge tpg 156
MC68HC11KW1 motorola 9-7 timing system 9 9.1.2.2 tic1?ic3 ?timer input capture registers when an edge has been detected and synchronized, the 16-bit free-running counter value is transferred into the input capture register pair as a single 16-bit parallel transfer. timer counter value captures and timer counter incrementing occur on opposite half-cycles of the phase 2 clock so that the count value is stable whenever a capture occurs. input capture values can be read from a pair of 8-bit read-only registers. a read of the high-order byte of an input capture register pair inhibits a new capture transfer for one bus cycle. if a double-byte read instruction, such as ldd, is used to read the captured value, coherency is assured. when a new input capture occurs immediately after a high-order byte read, transfer is delayed for an additional cycle but the value is not lost. the ticx registers are not affected by reset. 9.1.2.3 ti4/o5 ?timer input capture 4/output compare 5 register use ti4/o5 as either an input capture register or an output compare register, depending on the function chosen for the pa3 pin. to enable it as an input capture pin, set the i4/o5 bit in the pulse accumulator control register (pactl) to logic level one. to use it as an output compare register, set the i4/o5 bit to a logic level zero. refer to section 9.6.1. the ti4/o5 register pair resets to ones ($ffff). address bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 state on reset timer input capture 1 (tic1) high $0010 (bit 15) (14) (13) (12) (11) (10) (9) (bit 8) not aff ected timer input capture 1 (tic1) low $0011 (bit 7) (6) (5) (4) (3) (2) (1) (bit 0) not aff ected timer input capture 2 (tic2) high $0012 (bit 15) (14) (13) (12) (11) (10) (9) (bit 8) not aff ected timer input capture 2 (tic2) low $0013 (bit 7) (6) (5) (4) (3) (2) (1) (bit 0) not aff ected timer input capture 3 (tic3) high $0014 (bit 15) (14) (13) (12) (11) (10) (9) (bit 8) not aff ected timer input capture 3 (tic3) low $0015 (bit 7) (6) (5) (4) (3) (2) (1) (bit 0) not aff ected address bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 state on reset capture 4/compare 5 (ti4/o5) high $001e (bit 15) (14) (13) (12) (11) (10) (9) (bit 8) 1111 1111 capture 4/compare 5 (ti4/o5) low $001f (bit 7) (6) (5) (4) (3) (2) (1) (bit 0) 1111 1111 tpg 157
motorola 9-8 MC68HC11KW1 timing system 9 9.1.3 output compare use the output compare (oc) function to program an action to occur at a speci? time ?when the 16-bit counter reaches a speci?d value. for each of the ?e output compare functions, there is a separate 16-bit compare register and a dedicated 16-bit comparator. the value in the compare register is compared to the value of the free-running counter on every bus cycle. when the compare register matches the counter value, an output compare status ?g is set. the ?g can be used to initiate the automatic actions for that output compare function. to produce a pulse of a speci? duration, write a value to the output compare register that represents the time the leading edge of the pulse is to occur. the output compare circuit is con?ured to set the appropriate output either high or low, depending on the polarity of the pulse being produced. after a match occurs, the output compare register is reprogrammed to change the output pin back to its inactive level at the next match. a value representing the width of the pulse is added to the original value, and then written to the output compare register. because the pin state changes occur at speci? values of the free-running counter, the pulse width can be controlled accurately at the resolution of the free-running counter, independent of software latency. to generate an output signal of a speci? frequency and duty cycle, repeat this pulse-generating procedure. there are four 16-bit read/write output compare registers: toc1, toc2, toc3, and toc4, and the ti4/o5 register, which functions under software control as either ic4 or oc5. each of the oc registers is set to $ffff on reset. a value written to an oc register is compared to the free-running counter value during each e clock cycle. if a match is found, the particular output compare ?g is set in timer interrupt ?g register 1 (tflg1). if that particular interrupt is enabled in the timer interrupt mask register 1 (tmsk1), an interrupt is generated. in addition to an interrupt, a speci?d action can be initiated at one or more timer output pins. for oc[5:2], the pin action is controlled by pairs of bits (omx and olx) in the tctl1 register. the output action is taken on each successful compare, regardless of whether or not the ocxf ?g in the tflg1 register was previously cleared. oc1 is different from the other output compares in that a successful oc1 compare can affect any or all ?e of the oc pins. the oc1 output action taken when a match is found is controlled by two 8-bit registers with three bits unimplemented: the output compare 1 mask register, oc1m, and the output compare 1 data register, oc1d. oc1m speci?s which port a outputs are to be used, and oc1d speci?s what data is placed on these port pins. tpg 158
MC68HC11KW1 motorola 9-9 timing system 9 9.1.3.1 toc1?oc4 ?timer output compare registers all output compare registers are 16-bit read-write. each is initialized to $ffff at reset. if an output compare register is not used for an output compare function, it can be used as a storage location. a write to the high-order byte of an output compare register pair inhibits the output compare function for one bus cycle. this inhibition prevents inappropriate subsequent comparisons. coherency requires a complete 16-bit read or write. however, if coherency is not needed, byte accesses can be used. for output compare functions, write a comparison value to output compare registers toc1?oc4 and ti4/o5. when tcnt value matches the comparison value, speci?d pin actions occur. 9.1.3.2 cforc ?timer compare force register the cforc register allows forced early compares. foc[1:5] correspond to the ?e output compares. these bits are set for each output compare that is to be forced. the action taken as a result of a forced compare is the same as if there were a match between the ocx register and the free-running counter, except that the corresponding interrupt status ?g bits are not set. the forced channels trigger their programmed pin actions to occur at the next timer count transition after the write to cforc. the cforc bits should not normally be used on an output compare function that is programmed to toggle its output on a successful compare, because a normal compare occurring immediately before or after the force would produce a double toggle. this may be undesirable if it happens quickly, since the resulting output pulse would be very short. address bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 state on reset timer output compare 1 (t oc1) high $0016 (bit 15) (14) (13) (12) (11) (10) (9) (bit 8) 1111 1111 timer output compare 1 (t oc1) low $0017 (bit 7) (6) (5) (4) (3) (2) (1) (bit 0) 1111 1111 timer output compare 2 (t oc2) high $0018 (bit 15) (14) (13) (12) (11) (10) (9) (bit 8) 1111 1111 timer output compare 2 (t oc2) low $0019 (bit 7) (6) (5) (4) (3) (2) (1) (bit 0) 1111 1111 timer output compare 3 (t oc3) high $001a (bit 15) (14) (13) (12) (11) (10) (9) (bit 8) 1111 1111 timer output compare 3 (t oc3) low $001b (bit 7) (6) (5) (4) (3) (2) (1) (bit 0) 1111 1111 timer output compare 4 (t oc4) high $001c (bit 15) (14) (13) (12) (11) (10) (9) (bit 8) 1111 1111 timer output compare 4 (t oc4) low $001d (bit 7) (6) (5) (4) (3) (2) (1) (bit 0) 1111 1111 address bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 state on reset timer compare force (cforc) $000b foc1 foc2 foc3 foc4 foc5 0 0 0 0000 0000 tpg 159
motorola 9-10 MC68HC11KW1 timing system 9 foc[1:5] ?force output compares 1 (set) a forced output compare action will occur on the speci?d pin. 0 (clear) no action. bits [2:0] ?not implemented; always read zero 9.1.3.3 oc1m ?output compare 1 mask register use oc1m with oc1 to specify the bits of port a that are affected by a successful oc1 compare. the bits of the oc1m register correspond to pa7?a3. oc1m[7:3] ?output compare masks for oc1 1 (set) oc1 is con?ured to control the corresponding pin of port a. 0 (clear) oc1 will not affect the corresponding port a pin. bits [2:0] ?not implemented; always read zero. 9.1.3.4 oc1d ?output compare 1 data register use this register with oc1 to specify the data that is to be written to the affected pin of port a after a successful oc1 compare. when a successful oc1 compare occurs, a data bit in oc1d is written to the corresponding pin of port a for each bit that is set in oc1m. oc1d[7:3] ?output compare data for oc1 if oc1mx is set, data in oc1dx is output to port a pin x on successful oc1 compares. bits [2:0] ?not implemented; always read zero address bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 state on reset output compare 1 mask (oc1m) $000c oc1m7 oc1m6 oc1m5 oc1m4 oc1m3 0 0 0 0000 0000 address bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 state on reset output compare 1 data (oc1d) $000d oc1d7 oc1d6 oc1d5 oc1d4 oc1d3 0 0 0 0000 0000 tpg 160
MC68HC11KW1 motorola 9-11 timing system 9 9.1.3.5 tcnt ?timer counter register the 16-bit read-only tcnt register contains the prescaled value of the 16-bit timer. a full counter read addresses the more signi?ant byte (msb) ?st. a read of this address causes the less signi?ant byte (lsb) to be latched into a buffer for the next cpu cycle so that a double-byte read returns the full 16-bit state of the counter at the time of the msb read cycle. tcnt resets to $0000. 9.1.3.6 tctl1 ?timer control register 1 the bits of this register specify the action taken as a result of a successful ocx compare. om[2:5] ?output mode ol[2:5] ?output level these control bit pairs are encoded to specify the action taken after a successful ocx compare. oc5 functions only if the i4/o5 bit in the pactl register is clear. address bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 state on reset timer count (tcnt) high $000e (bit 15) (14) (13) (12) (11) (10) (9) (bit 8) 0000 0000 timer count (tcnt) low $000f (bit 7) (6) (5) (4) (3) (2) (1) (bit 0) 0000 0000 address bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 state on reset timer control 1 (tctl1) $0020 om2 ol2 om3 ol3 om4 ol4 om5 ol5 0000 0000 omx olx action taken on successful compare 0 0 timer disconnected from ocx pin logic 0 1 toggle ocx output line 1 0 clear ocx output line to 0 1 1 set ocx output line to 1 tpg 161
motorola 9-12 MC68HC11KW1 timing system 9 9.1.3.7 tmsk1 ?timer interrupt mask register 1 use this 8-bit register to enable or inhibit the timer input capture and output compare interrupts. note: bits in tmsk1 correspond bit for bit with ?g bits in tflg1. ones in tmsk1 enable the corresponding interrupt sources. oc1i?c4i ?output compare x interrupt enable 1 (set) ocx interrupt is enabled. 0 (clear) ocx interrupt is disabled. if the ocxi enable bit is set when the ocxf ?g bit is set, a hardware interrupt sequence is requested. i4/o5i ?input capture 4/output compare 5 interrupt enable 1 (set) ic4/oc5 interrupt is enabled. 0 (clear) ic4/oc5 interrupt is disabled. when i4/o5 in pactl is set, i4/o5i is the input capture 4 interrupt enable bit. when i4/o5 in pactl is zero, i4/o5i is the output compare 5 interrupt enable bit. ic1i?c3i ?input capture x interrupt enable 1 (set) icx interrupt is enabled. 0 (clear) icx interrupt is disabled. if the icxi enable bit is set when the icxf ?g bit is set, a hardware interrupt sequence is requested. address bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 state on reset timer interr upt mask 1 (tmsk1) $0022 oc1i oc2i oc3i oc4i i4/o5i ic1i ic2i ic3i 0000 0000 tpg 162
MC68HC11KW1 motorola 9-13 timing system 9 9.1.3.8 tflg1 ?timer interrupt ?g register 1 bits in this register indicate when timer system events have occurred. coupled with the bits of tmsk1, the bits of tflg1 allow the timer subsystem to operate in either a polled or interrupt driven system. clear ?gs by writing a one to the corresponding bit position(s). note: bits in tflg1 correspond bit for bit with ?g bits in tmsk1. ones in tmsk1 enable the corresponding interrupt sources. oc1f?c4f ?output compare x ?g 1 (set) counter has reached the preset output compare x value. 0 (clear) counter has not reached the preset output compare x value. these ?gs are set each time the counter matches the corresponding output compare x values. i4/o5f ?input capture 4/output compare 5 ?g set by ic4 or oc5, depending on the function enabled by i4/o5 bit in pactl ic1f?c3f ?input capture x ?g 1 (set) selected edge has been detected on corresponding port pin. 0 (clear) selected edge has not been detected on corresponding port pin. these ?gs are set each time a selected active edge is detected on the icx input line address bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 state on reset timer interrupt ?g 1 (tflg1) $0023 oc1f oc2f oc3f oc4f i4/o5f ic1f ic2f ic3f 0000 0000 tpg 163
motorola 9-14 MC68HC11KW1 timing system 9 9.1.3.9 tmsk2 ?timer interrupt mask register 2 use this 8-bit register to enable or inhibit timer over?w and real-time interrupts. the timer prescaler control bits are included in this register. note: bits [7:4] in tmsk2 correspond bit for bit with the ?g bits in tflg2. ones in bits [7:4] of tmsk2 enable the corresponding interrupt sources. toi ?timer over?w interrupt enable 1 (set) timer over?w interrupt requested when tof is set. 0 (clear) tof interrupts disabled. rtii ?real-time interrupt enable (refer to section 9.4) paovi ?pulse accumulator over?w interrupt enable (refer to section 9.6.3) paii ?pulse accumulator input edge interrupt enable (refer to section 9.6.3) pr[1:0] ?timer prescaler select these bits are used to select the prescaler divide-by ratio. in normal modes, pr[1:0] can only be written once, and the write must be within 64 cycles after reset. see table 9-1 for speci? timing values. these two bits also specify the number of divide-by-two stages that are to be inserted between the e-clock and the timer free-running counter of timer 3. this enables timer 1-timer 3 synchronization. this can, however, be overridden if a different prescale is required for timer 3, by writing to the timer 3 prescale bits in the register tctl6. see section 9.3.5. the default state is that the timer 1 prescale rate is used for timer 3. address bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 state on reset timer interr upt mask 2 (tmsk2) $0024 toi rtii paovi paii 0 0 pr1 pr0 0000 0000 pr[1:0] prescaler 0 0 1 0 1 4 1 0 8 1 1 16 tpg 164
MC68HC11KW1 motorola 9-15 timing system 9 9.1.3.10 tflg2 ?timer interrupt ?g register 2 bits in this register indicate when certain timer system events have occurred. coupled with the four high-order bits of tmsk2, the bits of tflg2 allow the timer subsystem to operate in either a polled or interrupt driven system. clear ?gs by writing a one to the corresponding bit position(s). note: bits in tflg2 correspond bit for bit with ?g bits in tmsk2. ones in tmsk2 enable the corresponding interrupt sources. tof ?timer over?w interrupt ?g 1 (set) tcnt has over?wed from $ffff to $0000. 0 (clear) no timer over?w has occurred. rtif ?real time (periodic) interrupt ?g (refer to section 9.4) paovf ?pulse accumulator over?w interrupt ?g (refer to section 9.6) paif ?pulse accumulator input edge interrupt ?g (refer to section 9.6.) bits [3:0] ?not implemented; always read zero 9.2 timer 2 timer 2 comprises a 4-stage prescaler and a 16-bit counter. it has three associated 16-bit output compare registers along with a software-programmable input capture or output compare register. the functions of timer 2 share i/o with the pins of port j as follows: the timer 2 prescaler is a 4 stage divider with the e clock as its input. prescaling factors of 1, 4, 8 or 16 can be selected by the p2ra and p2rb bits in the tctl4 register. timer 2 also offers an address bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 state on reset timer interrupt ?g 2 (tflg2) $0025 tof rtif paovf paif 0000 0000 0000 pin alternative function pj3 ecin pj4 oc1 pj5 oc2 pj6 oc3 pj7 c4 tpg 165
motorola 9-16 MC68HC11KW1 timing system 9 event counting mode of operation, in which the counter is clocked by an external source. in this case, the prescaler is bypassed and the external signal is used to clock the timer 2 counter directly. the input capture and output compare signals (oc1, oc2, oc3 and i1/oc4) are interfaced through port j pins [7:4]. if the timer is con?ured for event counting mode, then port j pin 3 is used as the input for the external clock. refer to figure 9-1 and figure 9-3. the timer 2 counter can be read at any time, and can be reset to $0000 by writing any value to it (in normal modes). in addition, the counter can be stopped and reset by setting the t2stp bit in the tctl4 register (see section 9.2.8). timer 2 can be switched to event counting mode by writing to the ecea and eceb bits in the tctl4 register. when switching to event counting mode, the counter is not reset to zero, but carries on from the state it was in at the time of switching. immediately before the switch it was sourced by the internal e clock, so the ?st 16-stage count cycle has an offset equal to the number of e clock cycles after reset before the ?st write to tctl4. the t2stp bit can be used to reset the counter to zero, if required. tpg 166
MC68HC11KW1 motorola 9-17 timing system 9 figure 9-3 timer 2 capture/compare block diagram pj3/ ecin & prescaler 1, 4, 8, 16 pr2[b:a] mcu e clock 16-bit free r unning counter tcnt2 (hi) tcnt2 (lo) t2oc1 (lo) & 3 t2oc1 (hi) 16-bit comparator eq t2oc2 (lo) t2oc2 (hi) 16-bit comparator eq t2oc3 (lo) t2oc3 (hi) 16-bit comparator eq 16-bit timer bus oc1f to2f to2i oc2f oc3f oc1i bit 7 & 2 oc2i & oc3i & 1 c4i bit 6 bit 5 bit 4 pj5/ oc2 pj6/ oc3 pj7/ c4 t2flg status flags t2msk interrupt enables port j pin control port j pin actions are controlled by the tctl3 and tctl4 registers. pins/ functions note ? ? interrupt requests 1, 2 & 3 (these are further qualified by the i-bit in the ccr). pj4/ oc1 ft2c1 + ft2c2 ft2c3 ft2c4 f23frc force o/p compare + + + t2c4 (lo) t2c4 (hi) 16-bit comparator eq 16-bit latch clk c4f i1/o4 oc4 ic1 2 2 clock select ecea, eceb tpg 167
motorola 9-18 MC68HC11KW1 timing system 9 9.2.1 output compare there are three dedicated output compare registers associated with timer 2 (t20c[3:1]). in addition, a fourth register (t2c4) is used either for a fourth output compare function or for an input capture function, depending on the state of the i1/o4 bit in the tctl4 register. the output compare function operates in a similar fashion to that on timer 1; a value written to an output compare register is compared to the free running counter value during each clock cycle. if a match is found, the appropriate output compare ?g is set in the interrupt ?g register (t2flg). an interrupt is then generated if that particular interrupt is enabled in the interrupt mask register (t2msk). unlike timer 1, which has separate interrupt requests for each interrupt, timer 2 output compare interrupts 1,2 and 3 are associated with a single interrupt sequence. this means that ?g polling is required if more than one interrupt is enabled. refer to figure 9-3. in addition to an interrupt, a successful output compare can trigger a speci?d action at the associated output port pins pj [7:4]. the type of action taken is de?ed by bits in timer control register tctl3. this action may be forced by setting the appropriate bit in the f23frc register (see section 9.2.3). 9.2.2 input capture when con?ured as an input capture register, the 16-bit t2c4 register is used to latch the value of the counter when a selected transition at pin pj7 is detected. the type of transition which triggers the capture is de?ed by the edga and edgb bits in the tctl4 register. 9.2.3 f23frc ?compare force register for timers 2 and 3. the f23frc register allows forced early compares for timers 2 and 3. bits [7:4] correspond to the four output compares of timer 3, and bits [3:0] correspond to those of timer 2. these bits are set for each output compare that is to be forced. the action taken as a result of a forced compare is the same as if there were a match between the ocx register and the free-running counter, except that the corresponding interrupt status ?g bits are not set. the forced channels trigger their programmed pin actions to occur at the next timer count transition after the write to f23frc. the f23frc bits should not normally be used on an output compare function that is programmed to toggle its output on a successful compare, because a normal compare occurring immediately before or after the force would produce a double toggle. this may be undesirable if it happens quickly, since the resulting output pulse would be very short. address bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 state on reset compare f orce for timers 2 and 3 (f23frc) $0031 ft3c1 ft3c2 ft3c3 ft3c4 ft2c1 ft2c3 ft2c3 ft2c4 0000 0000 tpg 168
MC68HC11KW1 motorola 9-19 timing system 9 ft3c[1:4] and ft2c[1:4] ?force output compares 1 (set) a forced output compare action will occur on the appropriate pin. 0 (clear) no action. 9.2.4 t2c4 ?timer 2 channel 4 register use t2c4 as either an input capture register or an output compare register, depending on the function chosen for the pj7 pin. to enable it as an input capture pin, set the i1/o4 bit in the timer control register 4 (tctl4). to use it as an output compare pin, clear the i1/o4 bit. refer to section 9.2.8. the t2c4 register pair resets to ones ($ffff). 9.2.5 t2oc1?2oc3 ?timer 2 output compare registers these three output compare registers are 16-bit read-write. each is initialized to $ffff at reset. if an output compare register is not used for an output compare function, it can be used as a storage location. a write to the high-order byte of an output compare register pair inhibits the output compare function for one bus cycle. this inhibition prevents inappropriate subsequent comparisons. coherency requires a complete 16-bit read or write. however, if coherency is not needed, byte accesses can be used. for output compare functions, write a comparison value to output compare registers t2oc1?2oc3 and ti1/o4. when tcnt2 value matches the comparison value, the speci?d pin actions occur. address bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 state on reset timer 2 channel 4 (t2c4) high $008a (bit 15) (14) (13) (12) (11) (10) (9) (bit 8) 1111 1111 timer 2 channel 4 (t2c4) low $008b (bit 7) (6) (5) (4) (3) (2) (1) (bit 0) 1111 1111 address bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 state on reset timer 2 output compare 1 (t2oc1) high $0084 (bit 15) (14) (13) (12) (11) (10) (9) (bit 8) 1111 1111 timer 2 output compare 1 (t2oc1) low $0085 (bit 7) (6) (5) (4) (3) (2) (1) (bit 0) 1111 1111 timer 2 output compare 2 (t2oc2) high $0086 (bit 15) (14) (13) (12) (11) (10) (9) (bit 8) 1111 1111 timer 2 output compare 2 (t2oc2) low $0087 (bit 7) (6) (5) (4) (3) (2) (1) (bit 0) 1111 1111 timer 2 output compare 3 (t2oc3) high $0088 (bit 15) (14) (13) (12) (11) (10) (9) (bit 8) 1111 1111 timer 2 output compare 3 (t2oc3) low $0089 (bit 7) (6) (5) (4) (3) (2) (1) (bit 0) 1111 1111 tpg 169
motorola 9-20 MC68HC11KW1 timing system 9 9.2.6 tcnt2 ?timer 2 counter register this 16-bit register can be read at any time. in normal modes (smod = 0), writing any value to the counter causes it to be reset to $0000. in special modes (smod = 1), any write to the most signi?ant byte (msb) causes the counter to be preset to $fff8. this preset capability is intended for factory testing only. the counter can be stopped and reset by writing to the t2stp bit in the tctl4 register (see section 9.2.8). the tcnt2 register contains the value of the 16-bit timer. a full counter read addresses the most signi?ant byte (msb) ?st. a read of this address causes the less signi?ant byte (lsb) to be latched into a buffer for the next cpu cycle so that a double-byte read returns the full 16-bit state of the counter at the time of the msb read cycle. tcnt2 resets to $0000. 9.2.7 tctl3 ?timer control register 3 (timer 2) the bits of this register specify the action taken as a result of a successful timer 2 ocx compare. om[1:4] ?output mode ol[1:4] ?output level these control bit pairs are encoded to specify the action taken after a successful ocx compare. oc4 functions only if the i1/o4 bit in the tctl4 register is clear. address bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 state on reset timer 2 count (tcnt2) high $0082 (bit 15) (14) (13) (12) (11) (10) (9) (bit 8) 0000 0000 timer 2 count (tcnt2) low $0083 (bit 7) (6) (5) (4) (3) (2) (1) (bit 0) 0000 0000 address bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 state on reset timer control register 3 (tctl3) $0080 om1 ol1 om2 ol2 om3 ol3 om4 ol4 0000 0000 omx olx action taken on successful compare 0 0 timer disconnected from ocx pin logic 0 1 toggle ocx output line 1 0 clear ocx output line to 0 1 1 set ocx output line to 1 tpg 170
MC68HC11KW1 motorola 9-21 timing system 9 9.2.8 tctl4 ?timer control register 4 (timer 2) edgb and edga ?input capture edge control this pair of bits con?ures the input capture edge detector circuits for ic1. ic1 functions only if the i1/o4 bit is set. note: the maximum frequency of the input clock must be less than e/2 when counting on one edge, and less that e/4 when counting on both edges. pr2a and pr2b ?timer 2 prescaler select these bits are used to select the prescaler divide-by ratio for timer 2. they can only be written to once after reset. eceb and ecea ?event counter edge control these control bits con?ure the input clock source for the timer 2 counter. they can be written to only once after reset. address bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 state on reset timer control register 4 (tctl4) $0081 edgb edga pr2b pr2a eceb ecea t2stp i1/04 0000 0000 edgb edga con guration 0 0 ic1 disabled 0 1 ic1 captures on rising edges only 1 0 ic1 captures on falling edges only 1 1 ic1 captures on any edge pr2b pr2a prescaler 0 0 1 0 1 4 1 0 8 1 1 16 eceb ecea con guration 0 0 timer 2 uses internal clock and prescaler 0 1 count on rising edges of external clock only 1 0 count on falling edges of external clock only 1 1 count on any edge of e xternal clock tpg 171
motorola 9-22 MC68HC11KW1 timing system 9 t2stp ?stop timer 2 counter 1 (set) timer 2 counter and prescaler are stopped and the counter is reset to $0000. 0 (clear) timer 2 counter operates normally. i1/o4 ?input capture 1/output compare 4 1 (set) input capture 1 function is enabled (no oc4) 0 (clear) output compare 4 function is enabled (no ic1) 9.2.9 t2msk ?timer 2 interrupt mask register use this 8-bit register to enable or inhibit the timer input capture and output compare interrupts. note: bits in t2msk correspond bit for bit with ?g bits in t2flg. ones in t2msk enable the corresponding interrupt sources. oc1i?c3i ?output compare x interrupt enable 1 (set) oc interrupt is enabled. 0 (clear) oc interrupt is disabled. if an ocxi enable bit is set when its associated ocxf ?g bit is set, a hardware interrupt sequence is requested. all three interrupt enable bits are associated with a single timer 2 output compare interrupt sequence; any successful output compare causes such an interrupt unless the corresponding ocxi bit is clear. therefore, ?g polling is required unless all but one of the interrupts have been disabled. c4i?input capture 1/output compare 4 interrupt enable 1 (set) ic1/oc4 interrupt is enabled. 0 (clear) ic1/oc4 interrupt is disabled. when i1/o4 in tctl4 is set, c4i is the input capture 1 interrupt enable bit. when i1/o4 in tctl4 is zero, c4i is the output compare 4 interrupt enable bit. address bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 state on reset timer 2 interr upt mask (t2msk) $008c oc1i oc2i oc3i c4i to2i 0 0 0 0000 0000 tpg 172
MC68HC11KW1 motorola 9-23 timing system 9 to2i ?timer 2 over?w interrupt enable 1 (set) timer 2 over?w interrupt requested when t2of is set. 0 (clear) t2of interrupts disabled. bits [2:0] ?not implemented; always read zero. 9.2.10 t2flg ?timer 2 interrupt ?g register bits in this register indicate when timer system events have occurred. clear ?gs by writing a one to the corresponding bit position(s). note: bits in t2flg correspond bit for bit with ?g bits in t2msk. ones in t2msk enable the corresponding interrupt sources. oc1f?c3f ?output compare x ?g 1 (set) counter has reached the preset output compare x value. 0 (clear) counter has not reached the preset output compare x value. these ?gs are set each time the counter matches the corresponding output compare x values. c4f ?input capture 1/output compare 4 ?g this ?g is set by ic1 or oc4, depending on the function enabled by i1/o4 bit in tctl4. if c4 is con?ured as an input capture channel, then: 1 (set) selected edge has been detected on pin pj7 0 (clear) selected edge has not been detected on pin pj7. to2f ?timer 2 over?w ?g 1 (set) tcnt2 has over?wed from $ffff to $0000. 0 (clear) no timer 2 over?w has occurred. bits [2:0] ?not implemented; always read zero. address bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 state on reset timer 2 interrupt ?g (t2flg) $008d oc1f oc2f oc3f c4f to2f 0 0 0 0000 0000 tpg 173
motorola 9-24 MC68HC11KW1 timing system 9 9.3 timer 3 timer 3 is very similar in operation to timer 2. its functions share i/o with port k pins as follows: when not in event counting mode, timer 3 can be driven either by the e clock divided by 1, 4, or 16, or by the timer 1 clock rate, as shown in figure 9-1. see also section 9.1.3.9. another difference between timers 2 and 3 is that timer 3 has only two interrupt request sequences associated with it (ic1/oc4/oc[3:1] and timer over?w), whereas timer 2 has three (oc[3:1], ic1/oc4 and timer over?w). see section 5 and section 9.3.5. apart from these two differences, timer 3 operates in the same way as timer 2. the control and data registers associated with timer 3 are described in the following paragraphs. note: timer 3 output compares can be forced using bits in the f23frc register, described in section 9.2.3. 9.3.1 t3c4 ?timer 3 channel 4 register use t3c4 as either an input capture register or an output compare register, depending on the function chosen for the pk7 pin. to enable it as an input capture pin, set the i1/o4 bit in the timer control register 4 (tctl6). to use it as an output compare pin, clear the i1/o4 bit. refer to section 9.3.5. the t3c4 register pair resets to ones ($ffff). pin alternative function pk3 ecin pk4 oc1 pk5 oc2 pk6 oc3 pk7 c4 address bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 state on reset timer 3 channel 4 (t2c4) high $009a (bit 15) (14) (13) (12) (11) (10) (9) (bit 8) 1111 1111 timer 3 channel 4(t2c4) low $009b (bit 7) (6) (5) (4) (3) (2) (1) (bit 0) 1111 1111 tpg 174
MC68HC11KW1 motorola 9-25 timing system 9 figure 9-4 timer 3 capture/compare block diagram & prescaler 1, 4, 16, or p3r[b:a] mcu e clock 16-bit free r unning counter tcnt3 (hi) tcnt3 (lo) t3oc1 (lo) & 2 t3oc1 (hi) 16-bit comparator eq t3oc2 (lo) t3oc2 (hi) 16-bit comparator eq t3oc3 (lo) t3oc3 (hi) 16-bit comparator eq 16-bit timer bus oc1f to3f to3i 1 oc2f oc3f oc1i bit 7 & 1 oc2i & 1 oc3i & 1 c4i bit 6 bit 5 bit 4 pk5/ oc2 pk6/ oc3 pk7/ c4 t3flg status flags t3msk interrupt enables port k pin control port k pin actions are controlled by the tctl5 and tctl6 registers. pins/ functions note ? ? interrupt requests 1 and 2 (these are further qualified by the i-bit in the ccr). pk4/ oc1 use timer 1 clock timer 1 clock rate ft3c1 + ft3c2 ft3c3 ft3c4 f23frc force o/p compare + + + t3c4 (lo) t3c4 (hi) 16-bit comparator eq 16-bit latch clk c4f i1/o4 oc4 ic1 pk3/ ecin clock select ecea, eceb tpg 175
motorola 9-26 MC68HC11KW1 timing system 9 9.3.2 t3oc1?3oc3 ?timer 3 output compare registers these three output compare registers are 16-bit read-write. each is initialized to $ffff at reset. if an output compare register is not used for an output compare function, it can be used as a storage location. a write to the high-order byte of an output compare register pair inhibits the output compare function for one bus cycle. this inhibition prevents inappropriate subsequent comparisons. coherency requires a complete 16-bit read or write. however, if coherency is not needed, byte accesses can be used. for output compare functions, write a comparison value to output compare registers t3oc1?3oc3 and ti1/o4. when the tcnt3 value matches the comparison value, speci?d pin actions occur. 9.3.3 tcnt3 ?timer 3 counter register this register can be read at any time. in normal modes (smod = 0), writing any value to the counter causes it to be rest to $0000. in special modes (smod = 1), any write to the most signi?ant byte (msb) causes the counter to be preset to $fff8.this preset capability is intended for factory testing only. the counter can be stopped and reset by writing to the t3stp bit in the tctl6 register (see section 9.3.5). the 16-bit read-only tcnt3 register contains the value of the 16-bit timer. a full counter read addresses the most signi?ant byte (msb) ?st. a read of this address causes the less signi?ant byte (lsb) to be latched into a buffer for the next cpu cycle so that a double-byte read returns the full 16-bit state of the counter at the time of the msb read cycle. tcnt3 resets to $0000. address bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 state on reset timer 3 output compare 1 (t3oc1) high $0094 (bit 15) (14) (13) (12) (11) (10) (9) (bit 8) 1111 1111 timer 3 output compare 1 (t3oc1) low $0095 (bit 7) (6) (5) (4) (3) (2) (1) (bit 0) 1111 1111 timer 3 output compare 2 (t3oc2) high $0096 (bit 15) (14) (13) (12) (11) (10) (9) (bit 8) 1111 1111 timer 3 output compare 2 (t3oc2) low $0097 (bit 7) (6) (5) (4) (3) (2) (1) (bit 0) 1111 1111 timer 3 output compare 3 (t3oc3) high $0098 (bit 15) (14) (13) (12) (11) (10) (9) (bit 8) 1111 1111 timer 3 output compare 3 (t3oc3) low $0099 (bit 7) (6) (5) (4) (3) (2) (1) (bit 0) 1111 1111 address bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 state on reset timer 3 count (tcnt3) high $0092 (bit 15) (14) (13) (12) (11) (10) (9) (bit 8) 0000 0000 timer 3 count (tcnt3) low $0093 (bit 7) (6) (5) (4) (3) (2) (1) (bit 0) 0000 0000 tpg 176
MC68HC11KW1 motorola 9-27 timing system 9 9.3.4 tctl5 ?timer control register 5 (timer 3) the bits of this register specify the action taken as a result of a successful timer 3 ocx compare. om[1:4] ?output mode ol[1:4] ?output level these control bit pairs are encoded to specify the action taken after a successful ocx compare. oc4 functions only if the i1/o4 bit in the tctl6 register is clear. 9.3.5 tctl6 ?timer control register 6 (timer 3) edgb and edga ?input capture edge control this pair of bits con?ures the input capture edge detector circuits for ic1. ic1 functions only if the i1/o4 bit is set. note: the maximum frequency of the input clock must be less than e/2 when counting on one edge, and less that e/4 when counting on both edges. address bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 state on reset timer control register 5 (tctl5) $0090 om1 ol1 om2 ol2 om3 ol3 om4 ol4 0000 0000 omx olx action taken on successful compare 0 0 timer disconnected from ocx pin logic 0 1 toggle ocx output line 1 0 clear ocx output line to 0 1 1 set ocx output line to 1 address bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 state on reset timer control register 6 (tctl6) $0091 edgb edga pr3b pr3a eceb ecea t3stp i1/04 0000 0000 edgb edga con guration 0 0 ic1 disabled 0 1 ic1 captures on rising edges only 1 0 ic1 captures on falling edges only 1 1 ic1 captures on any edge tpg 177
motorola 9-28 MC68HC11KW1 timing system 9 pr3a and pr3b ?timer 3 prescaler select these bits are used to select the prescaler divide-by ratio for timer 3. they can only be written to once after reset. if pr3b and pr3a are both cleared, then timer 3 is synchronized to the prescaled timer 1 rate, which is determined by the pr1 and pr0 bits in the tmsk2 register. see section 9.1.3.9 and figure 9-1. eceb and ecea ?event counter edge control these control bits con?ure the input clock source for the timer 3 counter. they can be written to only once after reset. t3stp ?stop timer 3 counter 1 (set) timer 3 counter and prescaler are stopped and the counter is reset to $0000. 0 (clear) timer 3 counter operates normally. i1/o4 ?input capture 1/output compare 4 1 (set) input capture 1 function is enabled (no oc4) 0 (clear) output compare 4 function is enabled (no ic1) pr3b pr3a prescaler 0 0 use timer 1 rate 0 1 1 1 0 4 1 1 16 eceb ecea con guration 0 0 timer 2 uses internal clock and prescaler 0 1 count on rising edges of external clock only 1 0 count on falling edges of external clock only 1 1 count on any edge of e xternal clock tpg 178
MC68HC11KW1 motorola 9-29 timing system 9 9.3.6 t3msk ?timer 3 interrupt mask register use this 8-bit register to enable or inhibit the timer input capture and output compare interrupts. note: bits in t3msk correspond bit for bit with ?g bits in t3flg. ones in t3msk enable the corresponding interrupt sources. oc1i?c3i ?output compare x interrupt enable 1 (set) ocx interrupt is enabled. 0 (clear) ocx interrupt is disabled. if an ocxi enable bit is set when its associated ocxf ?g bit is set, a hardware interrupt sequence is requested. these three bits and the c4i bit are associated with a single timer 3 output compare interrupt sequence; any successful output compare or input capture causes such an interrupt unless the corresponding ocxi or c4i bit is clear. therefore ?g polling is required if more than one interrupt is enabled. c4i?input capture 1/output compare 4 interrupt enable 1 (set) ic1/oc4 interrupt is enabled. 0 (clear) ic1/oc4 interrupt is disabled. when i1/o4 in tctl4 is set, c4i is the input capture 1 interrupt enable bit. when i1/o4 in tctl4 is zero, c4i is the output compare 4 interrupt enable bit. to3i ?timer 3 over?w interrupt enable 1 (set) timer 3 over?w interrupt requested when t3of is set. 0 (clear) t3of interrupts disabled. bits [2:0] ?not implemented; always read zero. address bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 state on reset timer 3 interr upt mask (t2msk) $009c oc1i oc2i oc3i c4i to2i 0 0 0 0000 0000 tpg 179
motorola 9-30 MC68HC11KW1 timing system 9 9.3.7 t3flg ?timer 3 interrupt ?g register bits in this register indicate when timer system events have occurred. clear ?gs by writing a one to the corresponding bit position(s). note: bits in t3flg correspond bit for bit with ?g bits in t3msk. ones in t3msk enable the corresponding interrupt sources. oc1f?c3f ?output compare x ?g 1 (set) counter has reached the preset output compare x value. 0 (clear) counter has not reached the preset output compare x value. these ?gs are set each time the counter matches the corresponding output compare x values. c4f ?input capture 1/output compare 4?g this ?g is set by ic1 or oc4, depending on the function enabled by the i1/o4 bit in tctl6. if c4 is con?ured as an input capture channel, then: 1 (set) selected edge has been detected on pin pk7 0 (clear) selected edge has not been detected on pin pk7. to3f ?timer 3 over?w ?g 1 (set) tcnt3 has over?wed from $ffff to $0000. 0 (clear) no timer 3 over?w has occurred. bits [2:0] ?not implemented; always read zero. address bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 state on reset timer 3 interrupt ?g (t3flg) $009d oc1f oc2f oc3f c4f to2f 0 0 0 0000 0000 tpg 180
MC68HC11KW1 motorola 9-31 timing system 9 9.4 real-time interrupt the real-time interrupt (rti) feature, used to generate hardware interrupts at a ?ed periodic rate, is controlled and con?ured by two bits (rtr1 and rtr0) in the pulse accumulator control (pactl) register. the rtii bit in the tmsk3 register enables the interrupt capability. the four different rates available are a product of the mcu oscillator frequency and the value of bits rtr[1:0]. refer to table 9-2, which shows the periodic real-time interrupt rates. the clock source for the rti function is a free-running clock that cannot be stopped or interrupted except by reset. this clock causes the time between successive rti timeouts to be a constant that is independent of the software latency associated with ?g clearing and service. for this reason, an rti period starts from the previous timeout, not from when rtif is cleared. every timeout causes the rtif bit in tflg2 to be set, and if rtii is set, an interrupt request is generated. after reset, one entire rti period elapses before the rtif ?g is set for the ?st time. refer to the tmsk2, tflg2, and pactl registers. 9.4.1 tmsk2 ?timer interrupt mask register 2 this register contains the real-time interrupt enable bit. note: bits [7:4] in tmsk2 correspond bit for bit with ?g bits in tflg2. ones in bits [7:4] tmsk2 enable the corresponding interrupt sources. toi ?timer over?w interrupt enable (refer to section 9.1.3.9) rtii ?real-time interrupt enable 1 (set) real time interrupt requested when rtif is set. 0 (clear) real time interrupts disabled. table 9-2 rti periodic rates rtr[1:0] e = 4mhz e = xmhz 0 0 0 1 1 0 1 1 1.02ms 2.05ms 4.09 ms 8.19 ms 2 12 /e 2 13 /e 2 14 /e 2 15 /e address bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 state on reset timer interr upt mask 2 (tmsk2) $0024 toi rtii paovi paii 0 0 pr1 pr0 0000 0000 tpg 181
motorola 9-32 MC68HC11KW1 timing system 9 paovi ?pulse accumulator over?w interrupt enable (refer to section 9.6) paii ?pulse accumulator input edge (refer to section 9.6) pr[1:0] ?timer prescaler select (refer to section 9.1.3.9) 9.4.2 tflg2 ?timer interrupt ?g register 2 bits of this register indicate the occurrence of timer system events. coupled with the four high-order bits of tmsk2, the bits of tflg2 allow the timer subsystem to operate in either a polled or interrupt driven system. clear ?gs by writing a one to the corresponding bit position(s). note: bits in tflg2 correspond bit for bit with ?g bits in tmsk2. ones in tmsk2 enable the corresponding interrupt sources. tof ?timer over?w interrupt ?g 1 (set) the timer has over?wed, from $ffff to $0000. 0 (clear) no timer over?w has occurred. rtif ?real-time interrupt ?g 1 (set) rti period has elapsed. 0 (clear) rti ?g has been cleared. the rtif status bit is automatically set to one at the end of every rti period. paovf ?pulse accumulator over?w interrupt ?g (refer to section 9.6) paif ?pulse accumulator input edge interrupt ?g (refer to section 9.6) bits [3:0] ?not implemented; always read zero address bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 state on reset timer interrupt ?g 2 (tflg2) $0025 tof rtif paovf paif 0000 0000 0000 tpg 182
MC68HC11KW1 motorola 9-33 timing system 9 9.4.3 pactl ?pulse accumulator control register bits rtr[1:0] of this register select the rate for the rti system. the remaining bits control the pulse accumulator and ic4/oc5 functions. bits 7, 3 ?not implemented; always read zero paen ?pulse accumulator system enable (refer to section 9.6) pamod ?pulse accumulator mode (refer to section 9.6) pedge ?pulse accumulator edge control (refer to section 9.6) i4/o5 ?input capture 4/output compare (refer to section 9.6) rtr[1:0] ?rti interrupt rate select these two bits determine the rate at which the rti system requests interrupts. the rti system is driven by an e/2 12 clock rate that is compensated so it is independent of the timer prescaler. these two control bits select an additional division factor. refer to table 9-2. 9.5 computer operating properly watchdog function the clocking chain for the cop function, tapped off from the main timer divider chain, is only super?ially related to the main timer system. the cr[1:0] bits in the option register and the nocop bit in the config register determine the status of the cop function. one additional register, coprst, is used to arm and clear the cop watchdog reset system. refer to section 5 for a more detailed discussion of the cop function. 9.6 pulse accumulator the MC68HC11KW1 has an 8-bit counter that can be con?ured to operate either as a simple event counter, or for gated time accumulation, depending on the state of the pamod bit in the pactl register. refer to the pulse accumulator block diagram, figure 9-5. in the event counting mode, the 8-bit counter is clocked to increasing values by an external pin. the maximum clocking rate for the external event counting mode is the e clock divided by two. in gated time accumulation mode, a free-running e clock ?64 signal drives the 8-bit counter, but only address bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 state on reset pulse accum ulator control (pa ctl) $0026 0 paen p amodpedge 0 i4/o5 rtr1 rtr0 0000 0000 tpg 183
motorola 9-34 MC68HC11KW1 timing system 9 while the external pai pin is activated. refer to table 9-3. the pulse accumulator counter can be read or written at any time. pulse accumulator control bits are also located within two timer registers, tmsk2 and tflg2, as described in the following paragraphs. table 9-3 pulse accumulator timing crystal frequency e clock cycle time 64/e pacnt over?w 16.0 mhz 4.0 mhz 250 ns 16.0 ? 4.096 ms figure 9-5 pulse accumulator block diagram tof 0 paovf paif 0 0 0 tflg2 rtif toi rtii 0 paii 0 pr1 pr0 tmsk2 0 paen 0 pamod pactl paovi rtr1 rtr0 pedge i4/o5 & & pacnt 1 2 pa7/ oc1/ pai 2:1 mux input buffer and edge detector output buffer & from ddra7 from oc1 e /64 clock (from main timer) overflow enable clock interrupt requests internal data bus disable f lag setting tpg 184
MC68HC11KW1 motorola 9-35 timing system 9 9.6.1 pactl ?pulse accumulator control register four of this registers bits control an 8-bit pulse accumulator system. another bit enables either the oc5 function or the ic4 function, while two other bits select the rate for the real-time interrupt system. bits [7, 3] ?not implemented; always read zero paen ?pulse accumulator system enable 1 (set) pulse accumulator enabled. 0 (clear) pulse accumulator disabled. pamod ?pulse accumulator mode 1 (set) gated time accumulation mode. 0 (clear) event counter mode. pedge ?pulse accumulator edge control this bit has different meanings depending on the state of the pamod bit, as shown: i4/o5 ?input capture 4/output compare 5 1 (set) input capture 4 function is enabled (no oc5). 0 (clear) output compare 5 function is enabled (no ic4). rtr[1:0] ?rti interrupt rate selects (refer to section 9.4) address bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 state on reset pulse accum ulator control (pa ctl) $0026 0 paen p amodpedge 0 i4/o5 rtr1 rtr0 0000 0000 pamo d pedge action of clock 0 0 pai falling edge increments the counter. 0 1 pai rising edge increments the counter. 1 0 a zero on pai inhibits counting. 1 1 a one on pai inhibits counting. tpg 185
motorola 9-36 MC68HC11KW1 timing system 9 9.6.2 pacnt ?pulse accumulator count register this 8-bit read/write register contains the count of external input events at the pai input, or the accumulated count. in gated time accumulation mode, pacnt is readable even if pai is not active. the counter is not affected by reset and can be read or written at any time. counting is synchronized to the internal ph2 clock so that incrementing and reading occur during opposite half cycles. 9.6.3 pulse accumulator status and interrupt bits the pulse accumulator control bits, paovi and paii, paovf, and paif are located within timer registers tmsk2 and tflg2. 9.6.3.1 tmsk2 ?timer interrupt mask 2 register 9.6.3.2 tflg2 ?timer interrupt ?g 2 register paovi and paovf ?pulse accumulator interrupt enable and over?w ?g the paovf status bit is set each time the pulse accumulator count rolls over from $ff to $00. to clear this status bit, write a one in the corresponding data bit position (bit 5) of the tflg2 register. the paovi control bit allows con?uring the pulse accumulator over?w for polled or interrupt-driven operation and does not affect the state of paovf. when paovi is zero, pulse accumulator over?w interrupts are inhibited, and the system operates in a polled mode, which requires that paovf be polled by user software to determine when an over?w has occurred. when the paovi control bit is set, a hardware interrupt request is generated each time paovf is set. before leaving the interrupt service routine, software must clear paovf by writing to the tflg2 register. address bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 state on reset pulse accum ulator count (pa cnt) $0027 (bit 7) (6) (5) (4) (3) (2) (1) (bit 0) unde?ed address bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 state on reset timer interr upt mask 2 (tmsk2) $0024 toi rtii paovi paii 0 0 pr1 pr0 0000 0000 address bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 state on reset timer interrupt ?g 2 (tflg2) $0025 tof rtif paovf paif 0000 0000 0000 tpg 186
MC68HC11KW1 motorola 9-37 timing system 9 paii and paif ?pulse accumulator input edge interrupt enable and ?g the paif status bit is automatically set each time a selected edge is detected at the pa7/pai/oc1 pin. to clear this status bit, write to the tflg2 register with a one in the corresponding data bit position (bit 4). the paii control bit allows con?uring the pulse accumulator input edge detect for polled or interrupt-driven operation but does not affect setting or clearing the paif bit. when paii is zero, pulse accumulator input interrupts are inhibited, and the system operates in a polled mode. in this mode, the paif bit must be polled by user software to determine when an edge has occurred. when the paii control bit is set, a hardware interrupt request is generated each time paif is set. before leaving the interrupt service routine, software must clear paif by writing to the tflg register. 9.7 pulse-width modulation (pwm) timer the pwm timer subsystem provides up to four 8-bit pulse-width modulated waveforms on the port h pins. channel pairs can be concatenated to create 16-bit pwm outputs. three clock sources (a, b, and s) and a ?xible clock select scheme give the pwm a wide range of frequencies. four control registers con?ure the pwm outputs ?pwclk, pwpol, pwscal, and pwen. the pwclk register selects the prescale value for the pwm clock sources and enables the 16-bit pwm functions. the pwpol register determines each channels polarity and selects the clock source for each channel. the pwscal register derives a user-scaled clock based on the a clock source, and the pwen register enables the pwm channels. each channel also has a separate 8-bit counter, period register, and duty cycle register. the period and duty cycle registers are double buffered so that if they are changed while the channel is enabled, the change does not take effect until the counter rolls over or the channel is disabled. a new period or duty cycle can be forced into effect immediately by writing to the period or duty cycle register and then writing to the counter. with pwms con?ured for 8-bit mode and e equal to 4mhz, pwm signals can be produced from 40 khz (1% duty cycle resolution) to less than 10 cycles per second (approximately 0.4% duty cycle resolution). by con?uring the pwms for 16-bit mode with e equal to 4mhz, pwm periods greater than one minute are possible. in 16-bit mode, duty cycle resolution of up to 15 parts per million can be achieved (at a pwm frequency of 60hz). in the same system, a pwm frequency of 1khz corresponds to a duty cycle resolution of 0.025%. pin alternative function ph0 pw1 ph1 pw2 ph2 pw3 ph3 pw4 tpg 187
motorola 9-38 MC68HC11KW1 timing system 9 9.7.1 pwm timer block diagram figure 9-6 shows the block diagram of the pwm timer subsystem. three different clock sources are selectable and provide inputs to the control registers. each of the four channels has a counter, a period register, and a duty register. the waveform output is the result of a match between the period register (pwperx) and the value in the counter (pwcntx). the duty register (pwdtyx) changes the state of the output during the period to determine the duty cycle. 9.7.2 pwclk ?pwm clock prescaler and 16-bit select register this register contains bits for selecting the 16-bit pwm options and the prescaler values for the clocks. 9.7.2.1 16-bit pwm function the pwclk register contains two control bits, each of which is used to concatenate a pair of pwm channels into one 16-bit channel. channels 3 and 4 are concatenated with the con34 bit, and channels 1 and 2 are concatenated with the con12 bit. when the 16-bit concatenated mode is selected, the clock source is determined by the low order channel. channel 2 is the low order channel when channels 1 and 2 are concatenated. channel 4 is the low order channel when channels 3 and 4 are concatenated. the pins associated with channels 1 and 3 can be used for general-purpose i/o when 16-bit pwm mode is selected. channel 1 registers are the high order byte of the double-byte channel when channels 1 and 2 are concatenated. channel 3 registers are the high order byte of the double-byte channel when channels 3 and 4 are concatenated. reads of the high order byte cause the low order byte to be latched for one cycle to guarantee that double byte reads are accurate. writes to the low byte of the counter cause reset of the entire counter. writes to the upper bytes of the counter have no effect. con34 ?concatenate channels 3 and 4 1 (set) channels 3 and 4 are concatenated into one 16-bit pwm channel. 0 (clear) channels 3 and 4 are separate 8-bit pwms. when concatenated, channel 3 is the high-order byte and the channel 4 pin (ph3) is the output. con12 ?concatenate channels 1 and 2 1 (set) channels 1 and 2 are concatenated into one 16-bit pwm channel. 0 (clear) channels 1 and 2 are separate 8-bit pwms. when concatenated, channel 1 is the high-order byte and the channel 2 pin (ph1) is the output. address bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 state on reset pulse width clock select (pwclk) $0060 con34 con12 pcka2 pcka1 0 pckb3 pckb2 pckb1 0000 0000 tpg 188
MC68HC11KW1 motorola 9-39 timing system 9 figure 9-6 pwm timer block diagram mcu e clock 8-bit comparator eq pwscal divider prescale select 1, 2, 4, 8, 16, 32, 64, 128 prescale select 1, 2, 4, 8 pckb1 pckb2 pckb3 pcka2 pcka1 8-bit counter 2 clock select clock select pwen3 pwen4 con34 clock b clock a clock s con12 pwen1 pwen2 pclk4 pclk3 pclk2 pclk1 reset 4 8 8-bit comparator eq ph0/ pw1 pwdty1 bit 0 bit 1 bit 2 bit 3 sq q r mux 8-bit comparator eq pwper1 8-bit comparator eq pwdty2 8-bit comparator eq pwper2 carry sq q r mux 16-bit pwm control reset reset ppol2 ppol1 con12 8-bit comparator eq pwdty3 sq q r mux 8-bit comparator eq pwper3 8-bit comparator eq pwdty4 8-bit comparator eq pwper4 carry sq q r mux 16-bit pwm control reset reset ppol4 ppol3 con34 port h pin control ph1/ pw2 ph2/ pw3 ph3/ pw4 pwcnt3 pwcnt4 pwcnt2 pwcnt1 cnt1 cnt2 cnt3 cnt4 tpg 189
motorola 9-40 MC68HC11KW1 timing system 9 9.7.2.2 clock prescaler selection the three available clocks are clock a, clock b, and clock s (scaled). clock a can be software selected to be e, e/2, e/4, or e/8. clock b can be software selected to be e, e/2, e/4,..., e/128. the scaled clock (clock s) uses clock a as an input and divides it with a reloadable counter. the rates available are software selectable to be clock a/2, down to clock a /512. the clock source portion of the block diagram shows the three clock sources and how the scaled clock is created. clock a is an input to an 8-bit counter which is then compared to a user programmable scale value. when they match, this circuit has an output that is divided by two and the counter is reset. each pwm timer channel can be driven by one of two clocks. refer to figure 9-6. pcka[2:1] ?prescaler for clock a determines the frequency of clock a. refer to table 9-4. bit 3 ? not implemented; always reads zero pckb[3:1] ?prescaler for clock b determines the frequency of clock b. refer to table 9-4. table 9-4 clock a and clock b prescalers pcka[2:1] clock a pckb[3:1] clock b 0 0 e 0 0 0 e 0 1 e/2 0 0 1 e/2 1 0 e/4 0 1 0 e/4 1 1 e/8 0 1 1 e/8 1 0 0 e/16 1 0 1 e/32 1 1 0 e/64 1 1 1 e/128 tpg 190
MC68HC11KW1 motorola 9-41 timing system 9 9.7.3 pwpol ?pwm timer polarity & clock source select register pclk[4:3] ?pulse width channel 4/3 clock select 1 (set) clock s is source. 0 (clear) clock b is source. pclk[2:1] ?pulse width channel 2/1 clock select 1 (set) clock s is source. 0 (clear) clock a is source. ppol[4:1] ?pulse width channel x polarity 1 (set) pwm channel x output is high at the beginning of the clock cycle and goes low when duty count is reached. 0 (clear) pwm channel x output is low at the beginning of the clock cycle and goes high when duty count is reached. each channel has a polarity bit that allows a cycle to start with either a high or a low level. this is shown on the block diagram, figure 9-6, as a selection of either the q output or the q output of the pwm output ?p ?p. when one of the bits in the pwpol register is set, the associated pwm channel output is high at the beginning of the clock cycle, then goes low when the duty count is reached. 9.7.4 pwscal ?pwm timer prescaler register scaled clock s is generated by dividing clock a by the value in pwscal, then dividing the result by two. if pwscal = $00, clock a is divided by 256, then divided by two to generate clock s. address bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 state on reset pulse width polarity select (pwpol) $0061 pclk4 pclk3 pclk2 pclk1 ppol4 ppol3 ppol2 ppol1 0000 0000 address bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 state on reset pulse width scale (pwscal) $0062 (bit 7) (6) (5) (4) (3) (2) (1) (bit 0) 0000 0000 tpg 191
motorola 9-42 MC68HC11KW1 timing system 9 9.7.5 pwen ?pwm timer enable register each timer has an enable bit to start its waveform output. writing any of these pwenx bits to one causes the associated port line to become an output regardless of the state of the associated ddr bit. this does not change the state of the ddr bit and when pwenx returns to zero the ddr bit again controls i/o state. on the front end of the pwm timer the clock is connected to the pwm circuit by the pwenx enable bit being high. there is a synchronizing circuit to guarantee that the clock will only be enabled or disabled at an edge. pwen contains 4 pwm enable bits ?one for each channel. when an enable bit is set to one, the pulse modulated signal becomes available at the associated port pin. tpwsl ?pwm scaled clock test bit (test mode only) 1 (set) clock s output to pwscal register (test only). 0 (clear) normal operation. when tpwsl is one, clock s from the pwm timer is output to pwscal register. normal writing to the pwscal register still functions. discp ?disable compare scaled e clock (test mode only) 1 (set) match of period does not reset associated count register (test only). 0 (clear) normal operation. bits [5:4] ? not implemented; always read zero pwen[4:1] ?pulse width channels 4? 1 (set) channel enabled on the associated port pin. 0 (clear) channel disabled. address bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 state on reset pulse width enable (pwen) $0063 tpwsl discp 0 0 pwen4pwen3pwen2pwen1 0000 0000 tpg 192
MC68HC11KW1 motorola 9-43 timing system 9 9.7.6 pwcnt1? ?pwm timer counter registers 1 to 4 each channel has its own counter which can be read at any time without affecting the count or the operation of the pwm channel. writing to a counter causes it to be reset to $00; this is generally done before the counter is enabled. a counter may also be written to whilst it is enabled; this may cause a truncated pwm period. 9.7.7 pwper1? ?pwm timer period registers 1 to 4 there is one period register for each channel. the value in this register determines the period of the associated pwm timer channel. pwperx is connected internally to a buffer which compares directly with the counter register. the period value in pwperx is loaded into the buffer when the counter is cleared by the termination of the previous period or by a write to the counter. this register can be written at any time, and the written value will take effect from the start of the next pwm timer cycle. reads of this register return the most recent value written. address bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 state on reset pulse width count 1 (pwcnt1) $0064 (bit 7) (6) (5) (4) (3) (2) (1) (bit 0) 0000 0000 pulse width count 2 (pwcnt2) $0065 (bit 7) (6) (5) (4) (3) (2) (1) (bit 0) 0000 0000 pulse width count 3 (pwcnt3) $0066 (bit 7) (6) (5) (4) (3) (2) (1) (bit 0) 0000 0000 pulse width count 4 (pwcnt4) $0067 (bit 7) (6) (5) (4) (3) (2) (1) (bit 0) 0000 0000 address bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 state on reset pulse width pe riod 1 (pwper1) $0068 (bit 7) (6) (5) (4) (3) (2) (1) (bit 0) 1111 1111 pulse width pe riod 2 (pwper2) $0069 (bit 7) (6) (5) (4) (3) (2) (1) (bit 0) 1111 1111 pulse width pe riod 3 (pwper3) $006a (bit 7) (6) (5) (4) (3) (2) (1) (bit 0) 1111 1111 pulse width pe riod 4 (pwper4) $006b (bit 7) (6) (5) (4) (3) (2) (1) (bit 0) 1111 1111 tpg 193
motorola 9-44 MC68HC11KW1 timing system 9 9.7.8 pwdty1? ?pwm timer duty cycle registers 1 to 4 there is one duty register for each channel. the value in this register determines the duty cycle of the associated pwm timer channel. pwdtyx is compared to the counter contents and if they are equal, a match occurs and the output goes to the state de?ed by the associated polarity bit. if the register is written while the channel is enabled, then the new value is held in a buffer until the counter rolls over or the channel is disabled. reads of this register return the most recent value written. note: if pwdtyx 3 pwperx then there will be no change of state due to the duty cycle value. in addition, if the duty register is set to $00, then the output will always be in the state which would normally be result from the duty change of state (see also section 9.7.9). 9.7.9 boundary cases the following boundary conditions apply to the values stored in the pwdtyx and pwperx registers and the ppolx bits: if pwdtyx = $00, pwperx > $00 and ppolx = 0 then the output is always high. if pwdtyx = $00, pwperx > $00 and ppolx = 1 then the output is always low. if pwdtyx 3 pwperx and ppolx = 0 then the output is always low. if pwdtyx 3 pwperx and ppolx = 1 then the output is always high. if pwperx = $00 and ppolx = 0 then the output is always low. if pwperx = $00 and ppolx = 1 then the output is always high. address bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 state on reset pulse width duty 1 (pwdty1) $006c (bit 7) (6) (5) (4) (3) (2) (1) (bit 0) 1111 1111 pulse width duty 2 (pwdty2) $006d (bit 7) (6) (5) (4) (3) (2) (1) (bit 0) 1111 1111 pulse width duty 3 (pwdty3) $006e (bit 7) (6) (5) (4) (3) (2) (1) (bit 0) 1111 1111 pulse width duty 4 (pwdty4) $006f (bit 7) (6) (5) (4) (3) (2) (1) (bit 0) 1111 1111 figure 9-7 pwm duty cycle pwmx pwperx pwdtyx tpg 194
MC68HC11KW1 motorola 10-1 analog-to-digital converter 10 10 analog-to-digital converter the analog-to-digital converter system consists of a single 10-bit successive approximation type converter and a 16-channel multiplexer. ten of the channels are connected to pins on the MC68HC11KW1 (ports e and g), two are unused and the remaining four channels are dedicated to internal reference points or test functions. the a/d converter shares input pins with port e and port g as follows: there are eight 10-bit result registers, and control logic allows for four or eight consecutive conversions before stopping, or for conversions to continue with the newest conversion overwriting the oldest result register. also, conversions can be performed several times on a single selected channel, or consecutively on a selected group of four channels. in addition, the control logic can convert eight channels and then stop, or convert continuously. two dedicated lines (vrh and vrl) are provided for the reference voltage inputs. these pins may be connected to a separate or isolated power supply to ensure full accuracy of the a/d conversion. furthermore, the a/d converter supply pins vddad and vssad allow the user to isolate the a/d voltage supply from the main vdd/vss supply lines. this reduces the effects that noise from the cpu core has on the a/d converter, thus improving accuracy. the 10-bit a/d converter accepts analog inputs ranging from v rl to v rh . smaller input ranges can also be obtained by adjusting v rl and v rh to the desired upper and lower limits. conversion is speci?d and tested for v rl = 0 volts and v rh = 5 volts. the a/d system can be operated with v rl below v dd and/or v rl above v ss as long as v rh is above v rl by enough to support the conversions (2.5 to 5.0 volts). pin alternative function pg6 an0 pg7 an1 pe0 an2 pe1 an3 pe2 an4 pe3 an5 pe4 an6 pe5 an7 pe6 an8 pe7 an9 tpg 195
motorola 10-2 MC68HC11KW1 analog-to-digital converter 10 each set of four conversions takes 144 cycles of the e-clock, provided that e is greater than or equal to 750 khz. if e is less than 750 khz, an internal r-c oscillator, which is nominally 1.5 mhz, must be used for the a/d conversion clock. when the internal r-c oscillator is being used as the conversion clock, the conversion complete ?g (ccf) must be used to determine when a conversion sequence has been completed. when using the internal r-c oscillator for a/d conversions, the sample and conversion process runs at the nominal 1.5 mhz rate; however, the conversion results must be transferred to the mcu result registers synchronously with the mcu e-clock, so conversion time is limited to a maximum of one channel per e-clock cycle. alternatively, if the r-c oscillator is not being used and e is greater than 2.1 mhz, the conversion frequency can be halved to e/2 under control of the ader bit in the adfrq register. note that in this operating mode, each set of four conversions takes 288 cycles of the e clock. two control bits in the option register control the basic con?uration of the a/d system. the a/d power-up bit (adpu) allows the system to be disabled, resulting in reduced power consumption when the a/d system is not being used. any conversion which is in process when adpu is written to zero will be aborted. a delay of typically 100 microseconds is required after turning on the a/d (by writing adpu from 0 to 1) for the analog and comparator sections to stabilize. the csel bit is used to select either the internal r-c oscillator or the mcu e-clock as the a/d system clock source. 10.1 conversion process the a/d converter is ratiometric. an input voltage equal to v rh converts to $ffc0 (full scale) and an input voltage equal to v rl converts to $0000. an input voltage greater than v rh will convert to $ffc0 with no over?w indication. note that the six least signi?ant bits always read zero. for ratiometric conversions, the source of each analog input should use v rh as the supply voltage and be referenced to v rl . the a/d reference inputs are applied to a precision internal digital-to-analog converter. control logic drives this d/a and the analog output is successively compared to the selected analog input which was sampled at the beginning of the conversion time. the conversion process is monotonic with no missing codes. 10.2 channel assignments a multiplexer allows the single a/d converter to select one of sixteen analog signals. ten of these channels are supported on port e and g input pins. of the six other channels, two are reserved for future use and four are for internal reference points and testing purposes. table 10-1 shows the signals selected by the channel select bits (cd, cc, cb, ca) in the adctl register. the conv8 bit selects either four or eight conversions. all ?eserved channels are connected to v rl . tpg 196
MC68HC11KW1 motorola 10-3 analog-to-digital converter 10 10.3 single channel operation single channel operation is selected by writing a zero to the mult bit in the a/d control and status register (adctl). this mode has four variations, which can be selected using the conv8 and scan bits in the adctl register. in the ?st two variations, the conv8 bit is clear and the single selected channel is converted four consecutive times. in the second two variations, the conv8 bit is set and the single selected channel is converted eight consecutive times. the state of the scan bit?etermines whether continuous or single scanning is selected. the channel is selected by the cd ?ca bits in the adctl register. if channels eight and nine are selected, then the result registers previously used for two of the other channels become overwritten with channel eight and nine results. table 10-1 channel assignments cd cc cb ca channel signal conv8 = 0 conv8 = 1 result in register if result in register if mult = 1 mult = 0 mult = 1 mult = 0 0 0 0 0 an2 (on pe0) adr5 adr5 ?8 adr1 adr1 ?8 0 0 0 1 an3 (on pe1) adr6 adr5 ?8 adr2 adr1 ?8 0 0 1 0 an4 (on pe2) adr7 adr5 ?8 adr3 adr1 ?8 0 0 1 1 an5 (on pe3) adr8 adr5 ?8 adr4 adr1 ?8 0 1 0 0 an6 (on pe4) adr5 adr5 ?8 adr5 adr1 ?8 0 1 0 1 an7 (on pe5) adr6 adr5 ?8 adr6 adr1 ?8 0 1 1 0 an8 (on pe6) adr7 adr5 ?8 adr7 adr1 ?8 0 1 1 1 an9 (on pe7) adr8 adr5 ?8 adr8 adr1 ?8 1 0 0 0 an0 (on pg6) adr5 adr5 ?8 adr1 adr1 ?8 1 0 0 1 an1 (on pg7) adr6 adr5 ?8 adr2 adr1 ?8 1 0 1 0 reserved adr7 adr5 ?8 adr3 adr1 ?8 1 0 1 1 reserved adr8 adr5 ?8 adr4 adr1 ?8 1 1 0 0 vrh (1) (1) used for factory testing. adr5 adr5 ?8 adr5 adr1 ?8 1101 vrl (1) adr6 adr5 ?8 adr6 adr1 ?8 1 1 1 0 vrh/2 (1) adr7 adr5 ?8 adr7 adr1 ?8 1 1 1 1 test (reserved) (1) adr8 adr5 ?8 adr8 adr1 ?8 tpg 197
motorola 10-4 MC68HC11KW1 analog-to-digital converter 10 10.3.1 4-conversion, single scan whichever port e or g pin is selected, the ?st result will be stored in the adr5 result register and the fourth result will be stored in the adr8 register. after the fourth conversion is complete all conversion activity is halted until a new conversion command is written to the adctl control register. 10.3.2 4-conversion, continuous scan conversions continue to be performed on the selected channel with the ?th conversion being stored in the adr5 register (overwriting the ?st conversion result), the sixth conversion overwrites adr6, the seventh overwrites adr7, and so on continuously. using this variation, the data in any result register is at most four conversion times old. 10.3.3 8-conversion, single scan the result of the ?st conversion will be placed in result register adr1, while the result of the eighth conversion will be placed in result register adr8. after the eighth conversion is complete all conversion activity is halted until a new conversion command is written to the adctl control register. 10.3.4 8-conversion, continuous scan conversions continue to be performed on the selected channel with the ninth conversion being stored in the adr1 register (overwriting the ?st conversion result), the tenth conversion overwrites adr2, the eleventh overwrites adr3, and so on continuously. using this variation, the data in any result register is at most eight conversion times old. 10.4 multiple channel operation multiple channel operation is selected by writing a one to the mult bit in the a/d control and status register (adctl). this mode has four variations, which can be selected using the conv8 and scan bits in the adctl register. in the ?st two variations, the conv8 bit is clear and a group of four channels is selected. in this multiple channel mode, the group of channels selected depends only on the two most signi?ant bits of the channel address (cd and cc). in the second two variations, the conv8 bit is set and a group of eight channels is selected, depending on the state of the cd bit. the state of the scan bit determines whether continuous or single scanning is selected. refer to table 10-1. tpg 198
MC68HC11KW1 motorola 10-5 analog-to-digital converter 10 10.4.1 4-channel single scan a group of four channels is selected by the cd and cc bits in the adctl register (see table 10-1). the ?st result is stored in the adr5 result register, the second in adr6, the third in adr7 and the fourth in the adr8 register. after the fourth conversion is complete, all conversion activity is halted until a new conversion command is written to the adctl control register. 10.4.2 4-channel continuous scan conversions continue to be performed on the selected group of channels with the ?th conversion being stored in the adr5 register (replacing the earlier conversion result for the ?st channel in the group), the sixth conversion overwrites adr6, the seventh overwrites adr7, and so on, continuously. using this second variation the data in any result register is, at most, four conversion times old. 10.4.3 8-channel single scan when conv8 is set and mult is set, then a group of eight channels is converted. the group is selected by the cd bit. each of the channels is converted and the result is placed in a separate result register. port e pin 0 uses result register adr1, port e pin 1 uses result register adr2 and so on. each channel is converted once, then all conversion activity is halted until a new conversion command is written to the adctl control register. 10.4.4 8-channel continuous scan conversions continue to be performed on the eight channels with the ninth conversion being stored in the adr1 register (replacing the earlier conversion result for the ?st channel in the group), the tenth conversion overwrites adr2, the eleventh overwrites adr3, and so on, continuously. using this second variation the data in any result register is, at most, eight conversion times old. 10.5 power-up and clock select a/d power up is controlled by the adpu bit in the option register. when adpu is cleared, power to the a/d system is removed. when adpu is set, the a/d system is enabled. a delay of 100 microseconds is required after turning on the a/d converter, to allow the analog bias voltages to stabilize. clock select is controlled by the csel bit in the option register. when csel is cleared, the a/d system uses the system e-clock. when csel is set, the a/d system uses an internal r-c clock tpg 199
motorola 10-6 MC68HC11KW1 analog-to-digital converter 10 source, nominally 1.5 mhz, in which case the r-c internal clock should be selected. a delay of 10 milliseconds is required, after changing csel from zero to one, to allow the r-c oscillator to start and internal bias voltages to settle. if the e-clock frequency drops below 750khz, then the internal r-c oscillator must be used. when the a/d system is operating with the mcu e-clock, all switching and comparator operations are synchronized with the mcu clock. this allows the comparator results to be sampled at quiet clock times to minimise the effect of internal switching noise. as the internal r-c oscillator is asynchronous with respect to the mcu clock, internal switching noise is more likely to affect the overall accuracy of the a/d results, when using this oscillator, than when using the e-clock. 10.6 operation in stop and wait modes if a conversion sequence is still in process when the MC68HC11KW1 enters the stop or wait mode, the conversion of the current channel is suspended. when the mcu resumes normal operation, that channel is re-sampled and the conversion sequence resumes. as the mcu exits the wait mode, the a/d circuits are stable and valid results can be obtained on the ?st conversion. however, in stop mode the comparator, charge pump and r-c oscillator are turned off. if the MC68HC11KW1 exits the stop mode with a delay (as is normal), there will automatically be enough time for these circuits to stabilize before the ?st conversion. if the MC68HC11KW1 exits the stop mode with no delay (dly bit in option register equal to zero) and a stable external clock supplied, the user must allow about 100 microseconds for the a/d circuitry to stabilize and to avoid invalid results. 10.7 registers 10.7.1 adctl ?a/d control and status register this register can be read and written at any time. note that a write to this register will always clear the ccf bit. ccf ?conversions complete ?g this ?g bit is set automatically after an a/d conversion cycle (four or eight conversions, depending on which conversion mode is selected). if a continuous scan mode is selected, the ccf ?g will become set after the ?st time all four (or eight) registers have been updated, and it will remain set until the address bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 state on reset a/d control & status register (adctl) $0030 ccf conv8 scan mult cd cc cb ca unde?ed tpg 200
MC68HC11KW1 motorola 10-7 analog-to-digital converter 10 adctl register is again written. each time the adctl register is written, this bit is automatically cleared, any current conversion is aborted and a new conversion sequence is started. conv8 ?convert 8/convert 4 select bit 1 (set) convert 8 channels or one channel 8 times, (uses all 8 result registers). 0 (clear) convert 4 channels or one channel 4 times (uses 4 result registers). scan ?continuous scan control 1 (set) convert continuously. 0 (clear) perform selected number of conversions (4 or 8) and stop. mult ?multiple channel/single channel control 1 (set) convert the channels in the selected group. 0 (clear) convert single channel selected. cd, cc, cb, ca ?channel select bits when 4-conversion (conv8 = 0) and multiple channel (mult=1) modes are selected, the cb and ca bits have no meaning or effect, and the cd and cc bits specify which of four groups of four channels are to be converted. when 8-conversion (conv8 = 1) and multiple channel (mult=1) modes are selected, the cc, cb and ca bits have no meaning or effect. refer to table 10-1 for a list of the a/d channel assignments. 10.7.2 adfrq ?a/d converter frequency select register this register can be read and written at any time. bits [7:1] ?not implemented; always read zero. ader ?a/d frequency select 1 (set) e/2 clock is used for a/d conversions. 0 (clear) e clock is used for a/d conversions. this bit improves the accuracy of conversion when the MC68HC11KW1 bus frequency is above 2.1mhz. address bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 state on reset a/d frequency select register (adfrq) $0032 0000000 ader 0000 0000 tpg 201
motorola 10-8 MC68HC11KW1 analog-to-digital converter 10 note if the csek bit in the option register is set, then the internal r-c oscillator (nominally 1.5mhz) is used for the a/d conversion and the ader bit has no effect on the frequency. 10.7.3 adr1 ?adr8 a/d result registers the eight 10-bit result registers are read-only; they can be read at any time, but a write will have no meaning or effect. in each result register, the eight high order bits are in one address location and the remaining two low order bits are in bit locations 6 and 7 of the following address. the six unused bits will always read as zeros. this allows a double byte read to be performed without having to adjust the result. address bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 state on reset a/d result 1 (adr1) high $0040 (bit 15) (14) (13) (12) (11) (10) (9) (8) unde?ed a/d result 1 (adr1) low $0041 (7) (6) 000000uu00 0000 a/d result 2 (adr2) high $0042 (bit 15) (14) (13) (12) (11) (10) (9) (8) unde?ed a/d result 2 (adr2) low $0043 (7) (6) 000000uu00 0000 a/d result 3 (adr3) high $0044 (bit 15) (14) (13) (12) (11) (10) (9) (8) unde?ed a/d result 3 (adr3) low $0045 (7) (6) 000000 uu00 0000 a/d result 4 (adr4) high $0046 (bit 15) (14) (13) (12) (11) (10) (9) (8) unde?ed a/d result 4 (adr4) low $0047 (7) (6) 000000 uu00 0000 a/d result 5 (adr5) high $0048 (bit 15) (14) (13) (12) (11) (10) (9) (8) unde?ed a/d result 5 (adr5) low $0049 (7) (6) 000000 uu00 0000 a/d result 6 (adr6) high $004a (bit 15) (14) (13) (12) (11) (10) (9) (8) unde?ed a/d result 6 (adr6) low $004b (7) (6) 000000 uu00 0000 a/d result 7 (adr7) high $004c (bit 15) (14) (13) (12) (11) (10) (9) (8) unde?ed a/d result 7 (adr7) low $004d (7) (6) 000000 uu00 0000 a/d result 8 (adr8) high $004e (bit 15) (14) (13) (12) (11) (10) (9) (8) unde?ed a/d result 8 (adr8) low $004f (7) (6) 000000 uu00 0000 tpg 202
MC68HC11KW1 motorola a-1 electrical specifications a a electrical specifications this section contains the electrical speci?ations and associated timing information for the standard supply voltage (v dd = 5v 5%) MC68HC11KW1. a.1 maximum ratings note: this device contains circuitry designed to protect against damage due to high electrostatic voltages or electric ?lds. however, it is recommended that normal precautions be taken to avoid the application of any voltages higher than those given in the maximum ratings table to this high impedance circuit. for maximum reliability all unused inputs should be tied to either v ss or v dd . rating symbol v alue unit supply voltage (1) (1) all voltages are with respect to v ss . v dd ?0.3 to +7.0 v input voltage (1) v in ?0.3 to +7.0 v oper ating temperature r ange t a t l to t h 40 to +85 c storage temper ature r ange t stg 50 to +150 c current drain per pin (2) ?not vdd, vss, vddad, vssad, vrh, vrl or ports h, k, (2) maximum current dr ain per pin is for one pin at a time, obser ving maximum power dissipation limits. i d 25 ma tpg 203
motorola a-2 MC68HC11KW1 electrical specifications a a.2 thermal characteristics and power considerations the average chip junction temperature, t j , in degrees celsius can be obtained from the following equation: [1] where: t a = ambient temperature ( c) q ja = package thermal resistance, junction-to-ambient ( c/w) p d = total power dissipation = p int + p i/o (w) p int = internal chip power = i dd ?v dd (w) p i/o = power dissipation on input and output pins (user determined) an approximate relationship between p d and t j (if p i/o is neglected) is: [2] solving equations [1] and [2] for k gives: [3] where k is a constant for a particular part. k can be determined by measuring p d (at equilibrium) for a known t a . using this value of k, the values of p d and t j can be obtained for any value of t a , by solving the above equations. the package thermal characteristics are shown below: characteristics symbol v alue unit thermal resistance ?100-pin tqfp package q ja 54 c/w t j t a p d q ja () + = p d k t j 273 + ---------------------- = kp d t a 273 + () q ja p d 2 + = tpg 204
MC68HC11KW1 motorola a-3 electrical specifications a a.3 test methods figure a-1 test methods ~v dd 0.4v v dd ?0.8v 0.4v nominal nominal ~v ss 70% of v dd 20% of v dd nominal timing ~v dd ~v ss v dd ?0.8v 0.4v clocks, strobes inputs outputs ~v dd 20% of v dd spec. spec. ~v ss 70% of v dd 20% of v dd spec. timing ~v dd ~v ss clocks, strobes inputs outputs (b) dc testing (c) ac testing 20% of v dd 70% of v dd v dd ?0.8v (2) 0.4v (2) 70% of v dd 20% of v dd notes: (1) full test loads are applied during all dc electrical tests and ac timing measurements. (2) during ac timing measurements, inputs are driven to 0.4v and v dd ?0.8v; timing measurements are taken at the 20% and 70% of v dd points. tpg 205
motorola a-4 MC68HC11KW1 electrical specifications a a.4 dc electrical characteristics (v dd = 5.0vdc 5%, v ss = 0vdc, t a = t l to t h , unless otherwise noted) characteristic symbol min. max. unit output voltage (1) ( i load = 10 m a ) all outputs e xcept xtal all outputs e xcept xtal, reset & moda (1) v oh speci?ation for reset and moda is not applicable as they are open-drain pins. v ol v oh v dd ?0.1 0.1 v v output high voltage (1) ( i load = ?.8 ma, v dd =4.5v ) all outputs e xcept xtal, reset & moda v oh v dd ?0.8 v output low voltage ( i load = +1.6ma ) all outputs e xcept xtal v ol 0.4 v input high voltage all inputs except reset reset v ih 0.7v dd 0.8v dd v dd + 0.3 v dd + 0.3 v input low voltage ?all inputs v il v ss ?0.3 0.2v dd v i/o ports three-state leakage ( v in = v ih or v il )i oz 10 m a input leakage (2) (v in = v dd or v ss ) irq , xirq (v in = v dd or v ss ) modb/v stby (2) refer to a/d speci?ation for the leakage current on a/d inputs. i in 1 10 m a m a input current with pull-up resistors ( v in = v il ) ports b, f, h, port g[5:0] i ipr 100 500 m a ram stand-by v oltage (power down) v sb 2.0 v dd v ram stand-by current (power down) i sb ?0 m a input capacitance pe[7:0], pg[7,6], irq , xirq , extal ports a, b, c, d, f, g[5:0], h, j, k, moda/lir , reset c in 8 12 pf pf output load capacitance all outputs e xcept pd[4:1], xout, xt al, mod a/lir xout pd[4:1] c l 90 30 200 pf maximum total supply current (3) : run: single chip mode expanded mode wait: (all peripheral functions shut down) single chip mode expanded mode stop: single chip mode, no clocks (3) extal is driven with a square wave. no dc loads. expansion bus active. all other ports con?ured as inputs; bus frequency is f 0 = 4.0mhz. i dd w idd s idd 40 50 25 30 100 ma ma ma ma m a maximum power dissipation single chip mode expanded mode p d 210 262.5 mw mw tpg 206
MC68HC11KW1 motorola a-5 electrical specifications a a.5 control timing (v dd = 5.0v 5%, v ss = 0vdc, t a = t l to t h unless otherwise noted) characteristic (1) (1) all timing is given with respect to 20% and 70% of v dd , unless otherwise noted. symbol 4.0 mhz unit min. max. frequency of operation f op 0 4.0 mhz e clock period t cyc 250 ns crystal frequency f xtal 16.0 mhz external oscillator frequency 4f op 0 16.0 mhz processor control setup time (t pcsu = 1/4 t cyc + 50 ns) t pcsu 112 ns reset input pulse width (2) (2) reset is recognized during the ?st clock cycle it is held low. internal circuitry then drives the pin low for eight clock cycles, releases the pin and samples the pin level four cycles later to determine the source of the interrupt. (see section 5.) pw rstl (3) pw rstl (4) (3) to guarantee an external reset vector. (4) this is the minimum input time; it can be pre- empted by an internal reset. 16 1 t cyc mode programming set-up time t mps 2t cyc mode programming hold time t mph 10 ns interrupt pulse width (irq edge sensitive mode) pw irq 270 ns interrupt pulse period (5) (5) the minimum per iod t ilih should not be less than the number of cycles it takes to execute the interrupt service plus 21 t cyc . t ilih note 5 t cyc wait recovery start-up time t wrs ?t cyc timer pulse width, input capture pulse accumulator input pw tim = t cyc + 20 ns pw tim 270 ns figure a-2 timer inputs pw tim notes pa[3:0] (2) pa[3:0] (1) pa7 (1), (3) pa7 (2), (3) (1) rising edge sensitive input. (2) falling edge sensitive input. (3) maximum pulse accum ulator clocking rate is e clock frequency divided by two (e/2). tpg 207
motorola a-6 MC68HC11KW1 electrical specifications a figure a-3 reset timing figure a-4 interrupt timing ffff fffe fffe fffe fffe fffe new ffff fffe fffe fffe fffe pc new pc v dd extal e reset moda, address modb t pordelay (1) t pcsu pw rstl t mps t mph (1) t pordelay = 4064 t cyc va+1 va sp? sp? e clock address (3) oa notes: sp? sp? sp oa+1 r/w t pcsu sp? sp? sp? sp? new pc sp? pw irq ? pcl pch iyl iyh op ixl ixh b a ccr ? vh vl op data (4) irq (1) irq (2) , xirq or internal interrupt (1) edge sensitive irq pin (irqe = 1). (2) level sensitive irq pin (irqe = 0). (3) where oa = opcode address and va = vector address. (4) where op = opcode, vh = v ector (msb) and vl = vector (lsb). tpg 208
MC68HC11KW1 motorola a-7 electrical specifications a figure a-5 stop recovery timing figure a-6 wait recovery timing fff3 fff2 sp? sp? sp? sp sa+2 new pc internal irq (1) e clock address (5) clocks sa+1 sa (6) sa+1 sa+1 sa (6) sa+1 op- code address (4) pw irq t stopdelay (3) irq (2) or xirq resume program with instruction which follows the stop instruction notes: (1) edge sensitive irq pin (irqe = 1). (2) level sensitive irq pin (irqe = 0). (4) xirq with x-bit in ccr = 1. (5) irq (or xirq , with x-bit = 0; in this case vector fetch will be $fff4/5). (6) sa = stop address. (3) if dly = 1: t stopdelay = 4064 t cyc if dly = 0: t stopdelay = 4 t cyc va+1 va (2) sp? sp? e clock address wa (1) wa+1 notes: reset also causes recovery from wait. (1) wa = wait address. (2) va = vector address. sp? sp??p? sp? sp??p? sp? sp new pc irq , xirq , or internal interr upts r/w t pcsu t wrs stack registers tpg 209
motorola a-8 MC68HC11KW1 electrical specifications a a.5.1 peripheral port timing (v dd = 5.0vdc 5%, v ss = 0vdc, t a = t l to t h ) characteristic (1) (1) all timing is given with respect to 20% and 70% of v dd , unless otherwise noted. symbol 4.0 mhz unit min. max. frequency of operation (e clock frequency) f op 0 4.0 mhz e clock period t cyc 250 ns peripheral data set-up time, all ports (2) (2) port c, and d timing is v alid for active drive (cw om, dw om, and w oms bits clear). t pdsu 100 ns peripheral data hold time, all ports (2) t pdh 50 ns delay time, peripheral data write mcu wr ite to port a, b, g[5:0], h, j or k mcu wr ite to port c, d or f (t pwd = t cyc /4 + 100ns) t pwd 200 162 ns ns figure a-7 port read timing diagram figure a-8 port g control timing mcu read of port e clock ports a, c, d, f, j, k ports t pdsu t pdh t pdsu t pdh b, e, h mcu read of port e clock pg[5:0] pg[7,6] t pdsu t pdh t pdsu t pdh tpg 210
MC68HC11KW1 motorola a-9 electrical specifications a figure a-9 port write timing diagram t pwd mcu wr ite to port t pwd previous port data new data v alid previous port data new data v alid e clock ports c, d, f ports a, b, g, h, j, k tpg 211
motorola a-10 MC68HC11KW1 electrical specifications a a.5.2 analog-to-digital converter characteristics (v dd = 5.0v 5%, v ss = 0v, v rh = v dd , v rl = v ss , t a = t l to t h , 750khz e 4mhz, unless otherwise noted (1) ) (1) in order to attain these accur acies with the eck > 2.1mhz, the ader bit in adfrq m ust be set. input clock duty cycles other than 50% will affect the a/d accuracies characteristic parameter min. absolute max. unit resolution number of bits resolved by adc 10 bits non-linearity (2) (2) non-linearity and offset error are characterised using the process window parameters aff ecting the adc accuracy, but they are not tested maximum d eviation from the best ?ting adc transfer character istics 1.0 lsb offset error (2) maximum offset from adc transfer character istics 1.0 lsb total unadjusted error maximum de viation from the ideal adc transfer character istics 1.5 lsb quantization error uncer tainty due to converter resolution 0.5 lsb absolute accuracy diff erence betw een the actual input voltage and the full-scale weighted equivalent of the binary output code, including all error sources 2.0 lsb conversion r ange analog input voltage r ange v rl ? rh v analog input voltage (3) (3) minimum analogue input voltage should not go below v rl -0.3v maximum analogue input voltage should not e xceed 1.125v rh maximum and minimum analog input voltage v rl ?0.3 1.125v rh v v rh maximum analog reference voltage v rl ? dd + 0.1 v v rl minimum analog reference voltage v ss ?0.1 v rh v d v r minimum diff erence between v rh and v rl 4.5 v monotinicity conversion result never decreases with an increase in input v oltage and has no missing codes guarantee d zero input reading conversion result when v in = v rl 0000 hex full scale reading conversion result when v in = v rh ffc0 hex input leakage (4) (4) source impedance should equal approximately 1 k w . source impedances g reater than 1 k w affect accuracy adve rsely because of input leakage. input leakage on a/d pins: pe[7:0], pg[7,6] 400 na input leakage v rh to v rl v rh to v rl divider chain current consumption 300 m a tpg 212
MC68HC11KW1 motorola a-11 electrical specifications a a.5.3 serial peripheral interface timing (v dd = 5.0vdc 5%, v ss = 0vdc, t a = t l to t h ) num characteristic (1) (1) all timing is given with respect to 20% and 70% of v dd , unless otherwise noted. symbol 4.0mhz unit min. max. oper ating frequency master slave f op(m) f op(s) 0 0 0.5 4.0 f op mhz 1 cycle time master slave t cyc(m) t cyc(s) 2.0 250 t cyc ns 2 enable lead time (2) master slave (2) signal production depends on software. t lead(m) t lead(s) 200 ns ns 3 enable lag time (2) master slave t lag(m) t lag(s) 200 ns ns 4 clock (sck) high time master slave t w(sckh)m t w(sckh)s 130 85 ns ns 5 clock (sck) low time master slave t w(sckl)m t w(sckl)s 130 85 ns ns 6 input data set-up time master slave t su(m) t su(s) 100 100 ns ns 7 input data hold time master slave t h(m) t h(s) 100 100 ns ns 8 access time (from high-z to data active) slave t a 0 120 ns 9 disable time (hold time to high-z state) slave t dis 125 ns 10 data v alid (after enable edge) (3) (3) assumes 200pf load on all spi pins. t v(s) 125 ns 11 output data hold time (after enable edge) t ho 0ns 12 rise time (3) spi outputs (sck, mosi and miso) spi inputs (sck, mosi, miso and ss ) t rm t rs 100 2.0 ns m s 13 fall time (3) spi outputs (sck, mosi and miso) spi inputs (sck, mosi, miso and ss ) t fm t fs 100 2.0 ns m s tpg 213
motorola a-12 MC68HC11KW1 electrical specifications a figure a-10 spi master timing (cpha = 0) figure a-11 spi master timing (cpha = 1) 1 ss (input) sck (cpol=0) (output) sck (cpol=1) (output) miso (input) mosi (output) (see note) (see note) ss is held high on master msb in lsb in bit 61 master msb out bit 61 master lsb out 13 12 13 5 4 4 5 7 11 10 12 13 6 10 (ref.) 11 (ref.) 12 note: this first clock edge is generated internally, but is not seen at the sck pin. 1 ss (input) sck (cpol=0) (output) sck (cpol=1) (output) miso (input) mosi (output) (see note) ss is held high on master msb in lsb in bit 61 master msb out bit 61 master lsb out 12 13 12 5 4 4 5 11 10 12 13 10 (ref.) 11 (ref.) 13 note: this last clock edge is generated internally, but is not seen at the sck pin. (see note) 7 6 tpg 214
MC68HC11KW1 motorola a-13 electrical specifications a figure a-12 spi slave timing (cpha = 0) figure a-13 spi slave timing (cpha = 1) 1 ss (input) sck (cpol=0) (input) sck (cpol=1) (input) mosi (input) miso (output) msb in lsb in bit 61 slave msb out bit 61 slave lsb out 12 13 12 5 4 4 5 8 11 13 note: not defined, but normally the msb of char acter just received. 7 6 10 (see note) 9 3 2 1 ss (input) sck (cpol=0) (input) sck (cpol=1) (input) mosi (input) miso (output) msb in lsb in bit 61 slave msb out bit 61 slave lsb out 12 13 12 5 4 4 5 8 11 13 note: not defined, but normally the lsb of char acter last tr ansmitted. 7 6 10 (see note) 9 3 2 tpg 215
motorola a-14 MC68HC11KW1 electrical specifications a a.5.4 non-multiplexed expansion bus timing (v dd = 5.0vdc 5%, v ss = 0vdc, t a = t l to t h ) num characteristic (1) (1) all timing is given with respect to 20% and 70% of v dd , unless otherwise noted. symbol 4.0mhz unit min. max. frequency of operation (e clock frequency) f op 0 4.0 mhz 1 e clock period t cyc 250 ns 2 pulse width, e low (2), (3) (2) input clock duty cycles other than 50% will affect the bus perfor mance. (3) for f op 2mhz the f ollowing form ulae may be used to calculate parameter values: pw el = t cyc /2 ?20ns pw eh = t cyc /2 ?25ns t ah = t cyc /8 ?10ns t ad = t cyc /8 + 40ns t av = pw el ?t ad t dhw = t cyc /8 t acca = t cyc ?t f ?t dsr ?t ad t dsw = pw eh ?t ddw t ecsa = pw eh ?t ecsd ?t dsr t acsa = t cyc ?t f ?t dsr ?t acsd pw el 105 ns 3 pulse width, e high (2), (3), (4) (4) indicates a parameter affected by clock stretching. add n(t cyc ) to the par ameter value, where n = 1, 2 or 3, depending on the valued written to the cscstr register. pw eh 100 ns 4a 4b e clock rise time fall time t r t f 20 15 ns 9 address hold time (3) t ah 21 ns 11 address delay time (3) t ad ?1ns 12 address valid to e rise time (3) t av 34 ns 17 read data set-up time t dsr 20 ns 18 read data hold time t dhr 0ns 19 write data delay time t ddw ?0ns 21 write data hold time (3) t dhw 31 ns 29 mpu address access time (3), (4) t acca 144 ns 39 write data set-up time (3), (4) t dsw 60 ns 50 e valid chip select delay time t ecsd ?5ns 51 e valid chip select access time (4) t ecsa 40 ns 52 chip select hold time t ch 025ns 54 address v alid chip select delay time t acsd 103 ns 55 address v alid chip select access time (4) t acsa 113 ns 56 address v alid to chip select time t avcs 10 ns 57 address v alid to data three-state time t avdz ?0ns tpg 216
MC68HC11KW1 motorola a-15 electrical specifications a a.6 eeprom characteristics figure a-14 expansion bus timing characteristic temperature range unit 40 to +85 c programming time, t eeprog (1) <1mhz, rco enabled 1?mhz, rco disabled 3 2mhz & whenever rco enabled (1) the rc oscillator (rco) must be enabled (by setting the csel bit in the option register) for eeprom programming and er asure when the e clock frequency is less than 1.0 mhz. 10 20 10 ms erase time: byte, row and b ulk (1) 10 ms write/er ase endurance (2) (2) refer to the current issue of motorolas quarterly reliability monitor report for the latest failure rate infor mation. 10 000 cycles data retention (2) 10 years e clock r/w , address data (read) data (write) 1 2 3 4b 4a 12 11 9 18 21 39 17 29 57 19 56 55 54 50 51 52 cs e cs ad valid valid tpg 217
motorola a-16 MC68HC11KW1 electrical specifications a this page left blank intentionally tpg 218
MC68HC11KW1 motorola b-1 mechanical data b b mechanical data b.1 packaging the MC68HC11KW1 is available packaged in a 100-pin thin quad ?t pack (tqfp). figure b-1 100-pin tqfp 75 74 72 71 70 69 68 67 66 65 64 63 62 61 60 73 pd3/mosi pd2/miso pd0/rxd pd1/txd 1 2 4 5 6 7 8 9 10 11 12 13 14 15 16 3 59 58 57 56 55 54 53 52 51 18 20 19 17 21 22 23 24 25 moda/lir modb/vstby reset xtal extal xout e vdd vss pc7/data7 pc6/data6 pc5/data5 pc4/data4 pc3/data3 pc2/data2 pc1/data1 pc0/data0 irq pf0/addr0 pf1/addr1 pf2/addr2 pk4/oc1 pk3/ecin pk2 pk1 pk0 ph0/pwm1 ph1/pwm2 ph2/pwm3 ph3/pwm4 ph4/csio ph5/csgp1 ph6/csgp2 ph7/ cspr og r/w xirq vdd vss pg0/xa13 pg1/xa14 pg2/xa15 pg3/xa16 pg4/xa17 pg5/xa18 pg6/an0 pg7/an1 100 99 97 96 95 94 93 92 91 90 89 88 87 86 85 98 pk5/oc2 pk6/oc3 pb0/addr8 pk7/c4 84 83 82 81 80 79 78 77 76 pb1/addr9 pb2/addr10 pb3/addr11 pb4/addr12 pb5/addr13 pb6/addr14 pb7/addr15 vdd vss pa0/ic3/oc1 pa1/ic2/oc1 pa2/ic1/oc1 pa3/ic4/oc5/oc1 pa4/oc4/oc1 pa5/oc3/oc1 pa6/oc2/oc1 pa7/pai/oc1 pd7 pd6 pd5/ss pd4/sck 26 27 29 30 31 32 33 34 35 36 37 38 39 40 41 28 43 45 44 42 46 47 48 49 50 vrh vrl vddad pe7/an9 pe6/an8 pe5/an7 pe4/an6 pe3/an5 pe2/an4 pe1/an3 pe0/an2 vssad pj0 pj1 pj2 pj3/ecin pj4/oc1 pj5/oc2 pj6/oc3 pj7/c4 pf7/addr7 pf6/addr6 pf5/addr5 pf4/addr4 pf3/addr3 tpg 219
motorola b-2 MC68HC11KW1 mechanical data b figure b-2 100-pin tqfp mechanical dimensions !($       
   $  $     $   $  $  $  $   $
  

    
 
 
          
  
    $  $         #  #         $ 
$  $ 
 $        $ 
$  $ 
 $   # #  # 
# q     q   q     q  
  
 !%$    $!     %!#   "#  $ *      ! %#!   $!  %#
 %&  $ !% % !%%! !    $ !  % (% %  (# %  )%$ % "$% !* % % !%%! ! % "#%     %&$       %!  %#  % %&    $! $ $   ' %!  %#  % $%  "  %   $! $     ! !%  & ! "#!%#&$!  !( "#!%#&$! $    "# $  $! $     !  & ! $%   # %#  % %&    $!  !$ !%  & # "#!%#&$!  # "#!%#&$! $ !% &$ %  (% %! ) 
    & $" %( "#!%#&$!    %  !# "#!%#&$!  
         v1 b1 3x view y s1 a1 4x 25 tips 4x v s a b         2x 02 $%  "  view aa 2x 03 c l       %  m 
 % h t n c 2 c1 k z w "  view aa ab ) g view y ab "%  u j d f #!%% $% section abab $    e q 1 q   2xr r1   x $   
 $ % case 983-01 tpg 220
MC68HC11KW1 motorola c-1 development systems c c development systems the following information provides a reference to development tools for the m68hc11 family of microcontrollers. for more detailed information please refer to the appropriate system manual. note: target cables for the evaluation module should be ordered separately. c.1 evs ?evaluation system the evs is an economical tool for designing, debugging and evaluating target systems based on the MC68HC11KW1 device. the two printed circuit boards that comprise the evs are the m68em11kw1 emulator module and the m68pfb11kit platform board. the main features of the evs are as follows: monitor/debugger ?mware single-line assembler/disassembler host computer download capability dual memory maps: 64k byte monitor map that includes 16k bytes of monitor eprom mcu extension i/o port for single chip, expanded and special test operating modes rs-232c terminal and host i/o ports logic analyser connector table c-1 m68hc11 development tools devices evaluation boards evaluation modules evaluation systems/kits pr ogrammer boards MC68HC11KW1 m68em11kw1 m68spgmr11 tpg 221
motorola c-2 MC68HC11KW1 development systems c c.2 mmds11 ?motorola modular development system the mmds11 is an emulator system that provides a bus state analyser and real-time memory windows. the units integrated design environment includes an editor, an assembler, user interface and source-level debug. a complete mmds11 consists of: a station module ?the metal mmds11 enclosure, containing the control board and the internal power supply. most system cables connect to the mmds11 station module. (the cable to an optional target system, however, runs through an aperture in the station module enclosure to connect directly to the emulator module). an emulator module (em) ?such as the em11kw1: a printed circuit board that enables system functionality for a speci? set of mcus. the em ?s into the station module through a sliding panel in the enclosure top. the em has a connector for the target cable. two logic clip cable assemblies ?twisted pair cables that connect the station module to your target system, a test ?ture, a clock or any other circuitry useful for evaluation or analysis. one end of each cable assembly has a moulded connector, which ?s into station module pod a or pod b. leads at the other end of the cable terminate in female probe tips. ball clips come with the cables. a 9-lead rs-232 serial cable ?the cable that connects the station module to the host computers rs-232 port. c.3 spgmr11 ?serial peripheral system the spgmr11 is an economical tool for programming m68hc11 mcus. the system consists of the m68spgmr11 unit and a programming module which adapts the spgmr11 to the appropriate mcu and package type. for the MC68HC11KW1, the programming module can be ordered as m68pa11kw1pu100 for the 100-pin packaged device. tpg 222
MC68HC11KW1 motorola i glossary glossary this section contains abbreviations and specialist words used in this data sheet and throughout the industry. further information on many of the terms may be gleaned from motorolas m68hc11 reference manual, m68hc11rm/ad , or from a variety of standard electronics text books. $xxxx the digits following the ? are in hexadecimal format. %xxxx the digits following the ? are in binary format. a/d , adc analog-to-digital (converter). bootstrap mode in this mode the device automatically loads its internal memory from an external source on reset and then allows this program to be executed. byte eight bits. ccr condition codes register; an integral part of the cpu. cerquad a ceramic package type, principally used for eprom and high temperature devices. clear ? ?the logic zero state; the opposite of ?et? cmos complementary metal oxide semiconductor. a semiconductor technology chosen for its low power consumption and good noise immunity. cop computer operating properly. aka ?atchdog? this circuit is used to detect device runaway and provide a means for restoring correct operation. cpu central processing unit. d/a, dac digital-to-analog (converter). eeprom electrically erasable programmable read only memory. aka ?erom? eprom erasable programmable read only memory. this type of memory requires exposure to ultra-violet wavelengths in order to erase previous data. aka ?rom? esd electrostatic discharge. expanded mode in this mode the internal address and data bus lines are connected to external pins. this enables the device to be used in much more complex systems, where there is a need for external memory for example. tpg 223
motorola ii MC68HC11KW1 glossary evs evaluation system. one of the range of platforms provided by motorola for evaluation and emulation of their devices. hcmos high-density complementary metal oxide semiconductor. a semiconductor technology chosen for its low power consumption and good noise immunity. i/o input/output; used to describe a bidirectional pin or function. input capture (ic) this is a function provided by the timing system, whereby an external event is ?aptured by storing the value of a counter at the instant the event is detected. interrupt this refers to an asynchronous external event and the handling of it by the mcu. the external event is detected by the mcu and causes a predetermined action to occur. irq interrupt request. the overline indicates that this is an active-low signal format. k byte a kilo-byte (of memory); 1024 bytes. lcd liquid crystal display. lsb least signi?ant byte. m68hc11 motorolas family of advanced 8-bit mcus. mcu microcontroller unit. msb most signi?ant byte. nibble half a byte; four bits. nrz non-return to zero. opcode the opcode is a byte which identi?s the particular instruction and operating mode to the cpu. see also: prebyte, operand. operand the operand is a byte containing information the cpu needs to execute a particular instruction. there may be from 0 to 3 operands associated with an opcode. see also: opcode, prebyte. output compare (oc) this is a function provided by the timing system, whereby an external event is generated when an internal counter value matches a prede?ed value. plcc plastic leaded chip carrier package. pll phase-locked loop circuit. this provides a method of frequency multiplication, to enable the use of a low frequency crystal in a high frequency circuit. prebyte this byte is sometimes required to qualify an opcode, in order to fully specify a particular instruction. see also: opcode, operand. pull-down, pull-up these terms refer to resistors, sometimes internal to the device, which are permanently connected to either ground or v dd . tpg 224
MC68HC11KW1 motorola iii glossary pwm pulse width modulation. this term is used to describe a technique where the width of the high and low periods of a waveform is varied, usually to enable a representation of an analog value. qfp quad ?t pack package. ram random access memory. fast read and write, but contents are lost when the power is removed. rfi radio frequency interference. rti real-time interrupt. rom read-only memory. this type of memory is programmed during device manufacture and cannot subsequently be altered. rs-232c a standard serial communications protocol. sar successive approximation register. sci serial communications interface. set ? ?the logic one state; the opposite of ?lear? silicon glen an area in the central belt of scotland, so called because of the concentration of semiconductor manufacturers and users found there. single chip mode in this mode the device functions as a self contained unit, requiring only i/o devices to complete a system. spi serial peripheral interface. test mode this mode is intended for factory testing. ttl transistor-transistor logic. uart universal asynchronous receiver transmitter. vco voltage controlled oscillator. watchdog see ?op? wired-or a means of connecting outputs together such that the resulting composite output state is the logical or of the state of the individual outputs. word two bytes; 16 bits. xirq non-maskable interrupt request. the overline indicates that this has an active-low signal format. tpg 225
motorola iv MC68HC11KW1 glossary this page left blank intentionally tpg 226
MC68HC11KW1 motorola v index index in this index numeric entries are placed ?st; page references in italics indicate that the reference is to a ?ure. 16-bit pwm 9-38 a a/d 10-1 accuracy of conversion 6-6 adctl ?a/d control and status register 10-6 adfrq ?a/d converter frequency select register 10-7 adr1?dr8 ?a/d results registers 10-8 pins 10-1 reset 5-9 accumulators 3-2 adctl ?a/d control and status register 10-6 addressing modes 3-7 address-mark wakeup 7-4 ader - bit in adfrq 10-7 adfrq ?a/d converter frequency select register 10-7 adr1?dr8 ?a/d results registers 10-8 b baud rates bootloader 4-2 sci 7-6 block diagrams MC68HC11KW1 1-3 pulse accumulator 9-34 pwm 9-39 sci 7-3 sci baud rate 7-1 spi 8-2 timer 9-17 , 9-25 timer clock divider chains 9-2 timers 9-5 bootloader 4-2 , 4-4 boundary conditions, pwm 9-44 bppue - bit in ppar 6-13 bprot ?block protect reg. 4-18 bprt[5:0] - bits in bprot 4-19 bspl - bit in scbdh 7-6 btst - bit in scbdh 7-6 bulkp - bit in bprot 4-19 bypassing 2-4 byte - bit in pprog 4-41 c c4f - bit in t2flg 9-23 c4f - bit in t3flg 9-30 c4i - bit in t2msk 9-22 c4i - bit in t3msk 9-29 c-bit in ccr 3-5 ccf - bit in adctl 10-6 ccr ?condition code reg. 3-4 cd?a - bits in adctl 10-7 cforc ?timer compare force register 9-9 chip selects cstl ?chip select control register 4-34 priorities 4-33 chip selects 4-32 clock stretching 4-39 cscstr ?chip select clock stretch register 4-39 general-purpose 4-35 gpcs1a ?general-purpose chip select 1 address reg. 4-35 gpcs1c ?general-purpose chip select 1 control reg. 4-36 gpcs2a ?general-purpose chip select 2 address reg. 4-37 gpcs2c ?general-purpose chip select 2 control reg. 4-37 i/o (csio) 4-33 program (csprog ) 4-33 clk4x - bit in config 4-12 clock monitor 5-3 , 5-5 clocks cmos compatible 2-3 e 2-3 , 4-17 monitor reset 5-3 , 5-5 pwm 9-40 spi 8-4 timer divider chains 9-2 cme - bit in option 5-4 coherency, timer 9-9 , 9-19 , 9-26 con12 - bit in pwclk 9-38 tpg 227
motorola vi MC68HC11KW1 index con34 - bit in pwclk 9-38 concatenation, of pwm 9-38 config ?system configuration reg. 4-12 programming 4-44 configuration 4-12 conv8 - bit in adctl 10-7 cop 9-3 , 9-33 config ?configuration control reg. 5-5 coprst ?arm/reset cop timer circuitry reg. 5-3 enable 5-6 option ?system configuration options reg. 1 5-4 rates 5-2 , 5-5 reset 5-2 , 5-3 , 5-8 timeout 5-2 coprst ?arm/reset cop timer circuitry reg. 5-3 corruption of a/d 6-6 of memory 2-2 cpha - bit in spcr 8-3 , 8-4 , 8-7 cpol - bit in spcr 8-7 cpu accumulators (a, b and d) 3-2 architecture 3-1 ccr ?condition code reg. 3-4 index registers (ix, iy) 3-2 program counter (pc) 3-4 programming model 3-1 registers 3-1 reset 5-7 cr[1:0] - bits in option 5-5 cscstr ?chip select clock stretch register 4-39 cstl ?chip select control register 4-34 cwom - bit in opt2 6-14 d data format, sci 7-2 data types 3-6 dda[7:0] - bits in ddra 6-2 ddb[7:0] - bits in ddrb 6-3 ddc[7:0] - bits in ddrc 6-4 ddd[5:0] - bits in ddrd 6-5 ddf[7:0] - bits in ddrf 6-7 ddg[7:0] - bits in ddrg 6-9 ddh[7:0] - bits in ddrh 6-10 ddj[7:0] - bits in ddrj 6-11 ddk[7:0] - bits in ddrk 6-12 ddra ?data direction reg. for port a 6-2 ddrb ?data direction reg. for port b 6-3 ddrc ?data direction reg. for port c 6-4 ddrd ?data direction reg. for port d 6-5 ddrf ?data direction reg. for port f 6-7 ddrg ?data direction reg. for port g 6-9 ddrh ?data direction reg. for port h 6-10 ddrj ?data direction reg. for port j 6-11 ddrk ?data direction reg. for port k 6-12 development tools c-1 dir - direct addressing mode 3-7 discp - bit in pwen 9-42 dly - bit in option 4-16 duty cycle, pwm 9-44 dwom - bit in spcr 8-6 e e clock pin 2-4 eceb, ecea - bits in tctl4 9-21 eceb, ecea - bits in tctl6 9-28 edgb, edga - bits in tctl4 9-21 edgb, edga - bits in tctl6 9-27 edgxa and edgxb - bits in tctl2 9-6 eelat - bit in pprog 4-42 eeon - bit in config 4-13 eepgm - bit in pprog 4-42 eeprom 4-41 4-44 erased state ($ff) 4-41 erasing 4-43 4-44 pprog ?eeprom programming control reg. 4-41 security 4-45 eex - bits in init2 4-15 erase - bit in pprog 4-42 erased state eeprom ($ff) 4-41 error detection, sci 7-5 esd protection a-1 even - bit in pprog 4-41 event counter - see pulse accumulator evs ?evaluation system c-1 expansion address lines 4-23 , 4-24 extal pin 2-3 f f23frc ?compare force reg. for timers 2 and 3 9-18 fcme - bit in option 5-5 fe - bit in scsr1 7-11 foc[1:5] - bits in cforc 9-10 fppue - bit in ppar 6-13 free-running counter 9-1 ft3cx, ft2cx - bits in f23frc 9-19 g g1a[18:11] - bits in gpcs1a 4-35 g1av - bit in gpcs1c 4-36 g1dg2 - bit in gpcs1c 4-36 g1dpc - bit in gpcs1c 4-36 g1pol - bit in gpcs1c 4-36 g1sza?1szd - bits in gpcs1c 4-36 g2a[18:11] - bits in gpcs2a 4-37 g2av - bit in gpcs2c 4-38 g2dpc - bit in gpcs2c 4-37 g2pol - bit in gpcs2c 4-38 g2sza?2szd - bits in gpcs2c 4-38 gcspr - bit in csctl 4-34 tpg 228
MC68HC11KW1 motorola vii index general-purpose chip selects 4-35 gp1sa, gp1sb - bits in cscstr 4-39 gp2sa, gp2sb - bits in cscstr 4-39 gpcs1a ?general-purpose chip select 1 address reg. 4-35 gpcs1c ?general-purpose chip select 1 control reg. 4-36 gpcs2a ?general-purpose chip select 2 address reg. 4-37 gpcs2c ?general-purpose chip select 2 control reg. 4-37 gppue - bit in ppar 6-13 h h-bit in ccr 3-6 hppue - bit in ppar 6-13 hprio ?highest priority i-bit interrupt & misc. reg. 4-11 i i/o chip select (csio) 4-33 i/o, on reset 5-7 i1/o4 - bit in tctl4 9-22 i1/o4 - bit in tctl6 9-28 i4/o5f - bit in tflg1 9-13 i4/o5i - bit in tmsk1 9-12 i-bit in ccr 3-5 , 5-14 ic1f?c3f - bits in tflg1 9-13 ic1i?c3i - bits in tmsk1 9-12 idle - bit in scsr1 7-10 idle-line wakeup 7-4 ilie - bit in sccr2 7-9 illegal opcode trap 5-14 ilt - bit in sccr1 7-8 imm - immediate addressing mode 3-7 ind, x/y - indexed addressing modes 3-8 index registers (ix, iy) 3-2 inh - inherent addressing mode 3-8 init ?ram and i/o mapping reg. 4-13 initialization 4-12 input capture 9-4 instruction set 3-8 internal oscillator 4-16 , a-15 interrupts i-bit 3-5 , 5-14 illegal opcode trap 5-14 irq 2-4 maskable 5-15 multiple sources 2-5 non-maskable 5-14 priorities 5-9 priority resolution 5-19 sci 5-22 , 7-14 sensitivity 2-4 stacking 5-13 swi 5-14 triggering 2-4 types 5-13 vectors 5-12 wired-or 2-4 x-bit 3-6 , 5-14 xirq 2-5 , 5-14 iocsa - bit in csctl 4-34 ioen - bit in csctl 4-34 iopl - bit in csctl 4-34 iosa, iosb - bits in cscstr 4-39 iosz - bit in csctl 4-34 irq pin 2-4 irqe - bit in option 4-16 irvne - bit in opt2 4-17 j junction temperature, chip a-2 l lcd driver interface 8-1 lir pin 2-5 lirdv - bit in opt2 4-17 loops - bit in sccr1 7-7 low power modes ram 4-4 stand-by connections 2-5 stand-by voltage 2-5 stop 5-16 wait 5-15 low voltage inhibit circuit 2-2 lsbf - bit in opt2 8-10 lvi 2-2 lvpen - bit in bprot 4-19 lvpi - bit in pprog 4-41 m m - bit in sccr1 7-7 mask options security 4-45 maximum ratings a-1 mda - bit in hprio 4-11 memory corruption of 2-2 eeprom 4-41 4-44 map 4-3 mapping 4-3 , 4-13 4-15 protection 4-18 , 4-45 ram 4-4 ram stand-by connections 2-5 register map 4-4 memory expansion 4-22 address lines 4-23 , 4-24 examples 4-24 ?? mm1cr, mm2cr ?memory mapping window 1 and 2 tpg 229
motorola viii MC68HC11KW1 index control registers 4-31 mmsiz ?memory mapping window size register 4-29 mmwbr ?memory mapping window base register 4-30 pgar ?port g assignment register 4-32 memory map, on reset 5-7 miso 8-4 mm1cr, mm2cr ?memory mapping window 1 and 2 control registers 4-31 mmsiz ?memory mapping window size register 4-29 mmwbr ?memory mapping window base register 4-30 moda/lir pin 2-5 modb/vstby pin 2-5 modf - bit in spsr 8-8 mosi 8-4 mstr - bit in spcr 8-5 , 8-6 mult ?bit in adctl 10-7 mxgs[2:1] - bits in mmsiz 4-29 n n-bit in ccr 3-5 nf - bit in scsr1 7-11 nmi 2-5 , 5-14 nocop - bit in config 5-6 noise 2-4 non-maskable interrupt 2-5 nosec - bit in config 4-46 o oc1d ?output compare 1 data register 9-10 oc1d[7:3] - bits in oc1d 9-10 oc1f?c3f - bits in t2flg 9-23 oc1f?c3f - bits in t3flg 9-30 oc1f?c4f - bits in tflg1 9-13 oc1i?c3i - bits in t2msk 9-22 oc1i?c3i - bits in t3msk 9-29 oc1i?c4i - bits in tmsk1 9-12 oc1m ?output compare 1 mask register 9-10 oc1m[7:3] - bits in oc1m 9-10 odd - bit in pprog 4-41 ol[1:4] - bits in tctl3 9-20 ol[1:4] - bits in tctl5 9-27 ol[2:5] - bits in tctl1 9-11 om[1:4] - bits in tctl3 9-20 om[1:4] - bits in tctl5 9-27 om[2:5] - bits in tctl1 9-11 operating modes 4-1 baud rates 4-2 bootstrap 4-2 expanded 4-1 hprio register 4-11 selection of 2-5 , 4-10 single chip 4-1 stop 4-4 , 5-16 test 4-2 vstby 4-4 wait 5-15 opt2 ?system configuration options reg. 2 4-17 option ?system configuration options reg. 1 5-4 or - bit in scsr1 7-11 oscillator 2-3 connections 2-3 output compare 9-8 overflow bit in ccr 3-5 p packages options 2-1 , b-1 thermal characteristics a-1 pacnt ?pulse accumulator count reg. 9-36 pactl ?pulse accumulator control reg. 9-35 paen - bit in pactl 9-35 paif - bit in tflg2 9-37 paii - bit in tmsk2 9-37 pamod - bit in pactl 9-35 paovf - bit in tflg2 9-36 paovi - bit in tmsk2 9-36 paren - bit in config 6-15 pcka[2:1] - bits in pwclk 9-40 pckb[3:1] - bits in pwclk 9-40 pclk[2:1] - bits in pwpol 9-41 pclk[4:3] - bits in pwpol 9-41 pcsa, pcsb - bits in cscstr 4-39 pcsen - bit in csctl 4-34 pcsza, pcszb - bits in csctl 4-34 pe - bit in sccr1 7-8 pedge - bit in pactl 9-35 pf - bit in scsr1 7-11 pgar ?port g assignment register 4-32 pgar[5:0] - bits in pgar 4-32 pins e clock 2-4 extal 2-3 irq 2-4 lir 2-5 moda/lir 2-5 modb/vstby 2-5 oc1, special features 9-4 , 9-8 r/w 2-6 reset 2-2 , 5-2 vdd ad, vss ad 2-4 vdd, vss 2-4 vrh, vrl 2-6 vstby 2-5 xirq 2-5 xout 2-4 xtal 2-3 por 5-1 porta ?port a data reg. 6-2 portb ?port b data reg. 6-3 portc ?port c data reg. 6-4 portd ?port d data reg. 6-5 porte ?port e data reg. 6-6 tpg 230
MC68HC11KW1 motorola ix index portf ?port f data reg. 6-7 portg ?port g data reg. 6-8 porth ?port h data reg. 6-10 portj ?port j data reg. 6-11 portk ?port k data reg. 6-12 ports a (timer 1) 2-6 , 6-2 b (addr[15:8]) 2-8 , 6-3 c (data[7:0]) 2-8 , 6-4 d (sci, spi) 2-8 , 6-5 ddra ?data direction reg. for port a 6-2 ddrb ?data direction reg. for port b 6-3 ddrc ?data direction reg. for port c 6-4 ddrd ?data direction reg. for port d 6-5 ddrf ?data direction reg. for port f 6-7 ddrg ?data direction reg. for port g 6-9 ddrh ?data direction reg. for port h 6-10 ddrj ?data direction reg. for port j 6-11 ddrk ?data direction reg. for port k 6-12 e (a/d) 2-9 , 6-6 f (addr[7:0]) 2-9 , 6-7 g (memory expansion, a/d) 2-9 , 6-8 h (chip select, pwm) 2-10 , 6-10 j (timer 2) 2-10 , 6-11 k (timer 3) 2-10 , 6-12 pgar ?port g assignment register 4-32 porta ?port a data reg. 6-2 portb ?port b data reg. 6-3 portc ?port c data reg. 6-4 portd ?port d data reg. 6-5 porte ?port e data reg. 6-6 portf ?port f data reg. 6-7 portg ?port g data reg. 6-8 porth ?port h data reg. 6-10 portj ?port j data reg. 6-11 portk ?port k data reg. 6-12 signals 2-6 power-on reset - see por ppar ?port pull-up assignment reg. 6-13 ppol[4:1] - bits in pwpol 9-41 pprog ?eeprom programming control reg. 4-41 pr[1:0] - bits in tmsk2 4-20 , 9-14 pr2a, pr2b - bits in tctl4 9-21 pr3a, pr3b - bits in tctl6 9-28 prebyte 3-7 prescaler, pwm 9-40 priorities, resets and interrupts 5-9 , 5-11 program chip select (csprog ) 4-33 program counter (pc) 3-4 programming config 4-44 eeprom 4-41 protection of memory 4-18 , 4-45 registers 4-10 psel[4:0] - bits in hprio 5-11 pt - bit in sccr1 7-8 ptcon - bit in bprot 4-19 pull-ups 6-13 pulse accumulator 9-1 , 9-33 block diagram 9-34 pacnt ?pulse accumulator count reg. 9-36 pactl ?pulse accumulator control reg. 9-35 reset 5-8 tflg2 ?timer interrupt flag 2 reg. 9-36 tmsk2 ?timer interrupt mask 2 reg. 9-36 pulse-width modulation - see pwm pwclk ?pwm clock prescaler and 16-bit select reg. 9-38 pwcnt1? ?pwm timer counter reg. 1 to 4 9-43 pwdty1? ?pwm timer duty cycle reg. 1 to 4 9-44 pwen ?pwm timer enable reg. 9-42 pwen[4:1] - bits in pwen 9-42 pwm 9-37 16-bit operation 9-38 block diagram 9-39 boundary conditions 9-44 clock select 9-40 duty cycle 9-37 , 9-44 periods 9-37 pins 9-37 pwclk ?pwm clock prescaler and 16-bit select reg. 9-38 pwcnt1? ?pwm timer counter reg. 1 to 4 9-43 pwdty1? ?pwm timer duty cycle reg. 1 to 4 9-44 pwen ?pwm timer enable reg. 9-42 pwper1? ?pwm timer period reg. 1 to 4 9-43 pwpol ?pwm timer polarity & clock source select reg. 9-41 pwscal ?pwm timer prescaler reg. 9-41 pwper1? ?pwm timer period reg. 1 to 4 9-43 pwpol ?pwm timer polarity & clock source select reg. 9-41 pwscal ?pwm timer prescaler reg. 9-41 r r/t[7:0] - bits in scdrl 7-12 r/w pin 2-6 r8 - bit in scdrh 7-12 raf - bit in scsr2 7-11 ram 4-4 data retention 4-4 security 4-45 ram[3:0] - bit in init 4-13 rboot - bit in hprio 4-11 rdrf - bit in scsr1 7-10 re - bit in sccr2 7-9 real-time interrupt - see rti receiver flags, sci 7-13 reg[3:0] - bit in init 4-13 rel - relative addressing mode 3-8 reset pin 2-2 resets circuit 2-2 clock monitor 5-3 , 5-5 cop 5-2 , 5-3 effect on a/d 5-9 effect on cop 5-8 effect on cpu 5-7 tpg 231
motorola x MC68HC11KW1 index effect on i/o 5-7 effect on memory map 5-7 effect on pulse accumulator 5-8 effect on rti 5-8 effect on sci 5-8 effect on spi 5-9 effect on system 5-9 effect on timer 5-7 effects of 5-6 external 5-2 hprio ?highest priority i-bit interrupt and misc. reg. 5-10 power-on, por 5-1 priorities 5-9 processing flow 5-17 reset pin 5-2 vectors 5-6 , 5-12 resetting the cop watchdog 5-3 rfi 2-4 rie - bit in sccr2 7-9 row - bit in pprog 4-42 rti 9-1 , 9-31 pactl ?pulse accumulator control reg. 9-33 rates 9-31 reset 5-8 tflg2 ?timer interrupt flag reg. 2 9-32 tmsk2 ?timer interrupt mask reg. 2 9-31 rtif - bit in tflg2 9-32 rtii - bit in tmsk2 9-31 rtr[1:0] - bits in pactl 9-33 rwu - bit in sccr2 7-4 , 7-9 s s-bit in ccr 3-6 sbk - bit in sccr2 7-9 sbr[12:0] - bits in scbdh/l 7-6 scan - bit in adctl 10-7 scbdh, scbdl ?sci baud rate control reg. 7-6 sccr1 ?sci control reg. 1 7-7 sccr2 ?sci control reg. 2 7-9 scdrh, scdrl ?sci data high/low reg. 7-12 sci 7-1 baud rate 7-1 , 7-6 block diagram 7-3 data format 7-2 error detection 7-5 interrupt source resolution 5-22 , 7-14 pins 7-1 receive operation 7-2 reset 5-8 scbdh, scbdl ?sci baud rate control reg. 7-6 sccr1 ?sci control reg. 1 7-7 sccr2 ?sci control reg. 2 7-9 scdrh, scdrl ?sci data high/low reg. 7-12 scsr1 ?sci status reg. 1 7-10 scsr2 ?sci status reg. 2 7-11 status flags 7-12 transmit operation 7-2 wakeup 7-4 sck 8-4 scsr1 ?sci status reg. 1 7-10 scsr2 ?sci status reg. 2 7-11 security 4-45 mask option 4-45 nosec bit 4-46 sensitivity, of interrupts 2-5 , 4-16 serial communications interface - see sci serial peripheral interface - see spi slave select (ss ) 8-4 smod - bit in hprio 4-11 software interrupt (swi) 5-14 spcr ?serial peripheral control reg. 8-6 spdr ?spi data reg. 8-9 spe - bit in spcr 8-6 spi 8-1 block diagram 8-2 buffering 8-1 , 8-9 clock phase 8-3 clock polarity 8-7 clock rate 8-4 , 8-7 errors 8-5 master mode 8-6 miso 8-4 mosi 8-4 opt2 ?system configuration options reg. 2 8-9 pins 8-1 polarity 8-3 reset 5-9 sck 8-4 signals 8-3 spcr ?serial peripheral control reg. 8-6 spdr ?spi data reg. 8-9 spsr ?serial peripheral status reg. 8-8 ss 8-4 transfer formats 8-2 , 8-3 spie - bit in spcr 8-5 , 8-6 spif - bit in spsr 8-8 spr1 and spr0 - bits in spcr 8-7 spr2 - bit in opt2 8-10 spsr ?serial peripheral status reg. 8-8 stack pointer (sp) 3-2 stacking operations 3-3 stand-by voltage 2-5 status flags, sci 7-12 stop mode 4-4 , 5-16 disabling 3-6 swi 5-14 sync - bit in opt2 7-6 system reset 5-9 t t2c4 ?timer 2 channel 4 register 9-19 t2flg ?timer 2 interrupt flag register 9-23 t2msk ?timer 2 interrupt mask register 9-22 t2oc1?2oc3 ?timer 2 output compare registers 9-19 t2stp - bit in tctl4 9-22 tpg 232
MC68HC11KW1 motorola xi index t3c4 ?timer 3 channel 4 register 9-24 t3flg ?timer 3 interrupt flag register 9-30 t3msk ?timer 3 interrupt mask register 9-29 t3oc1?3oc3 ?timer 3 output compare registers 9-26 t3stp - bit in tctl6 9-28 t8 - bit in scdrh 7-12 tc - bit in scsr1 7-10 tcie - bit in sccr2 7-9 tcnt ?timer counter register 9-11 tcnt2 ?timer 2 counter register 9-20 tcnt3 ?timer 3 counter register 9-26 tctl1 ?timer control register 1 9-11 tctl2 ?timer control register 2 9-6 tctl3 ?timer control register 3 (timer 2) 9-20 tctl4 ?timer control register 4 (timer 2) 9-21 tctl5 ?timer control register 5 (timer 3) 9-27 tctl6 ?timer control register 6 (timer 3) 9-27 tdre - bit in scsr1 7-10 te - bit in sccr2 7-9 test methods a-3 tflg1 ?timer interrupt flag register 1 9-13 tflg2 ?timer interrupt flag register 2 9-15 ti4/o5 ?timer input capture 4/output compare 5 register 9-7 tic1?ic3 ?timer input capture register 9-7 tie - bit in sccr2 7-9 time accumulation - see pulse accumulator timers 9-1 block diagrams 9-5 , 9-17 , 9-25 cforc ?timer compare force register 9-9 clock divider chains 9-2 coherency 9-9 , 9-19 , 9-26 cop 9-33 f23frc ?compare force reg. for timers 2 and 3 9-18 free-running counter 9-1 input capture 9-4 , 9-18 oc1, special features 9-4 , 9-8 oc1d ?output compare 1 data register 9-10 oc1m ?output compare 1 mask register 9-10 output compare 9-8 , 9-18 pins 9-3 , 9-15 , 9-24 reset 5-7 t2c4 ?timer 2 channel 4 register 9-19 t2flg - timer 2 interrupt flag register 9-23 t2msk - timer 2 interrupt mask register 9-22 t2oc1?2oc3 ?timer 2 output compare registers 9-19 t3c4 ?timer 3 channel 4 register 9-24 t3flg - timer 3 interrupt flag register 9-30 tcnt ?timer counter register 9-11 tcnt2 ?timer 2 counter register 9-20 tcnt3 ?timer 3 counter register 9-26 tctl1 ?timer control register 1 9-11 tctl2 ?timer control register 2 9-6 tctl3 ?timer control register 3 (timer 2) 9-20 tctl4 ?timer control register 4 (timer 2) 9-21 tctl5 ?timer control register 5 (timer 3) 9-27 tctl6 ?timer control register 6 (timer 3) 9-27 tflg1 ?timer interrupt flag register 1 9-13 tflg2 ?timer interrupt flag register 2 9-15 ti4/o5 ?timer input capture 4/output compare 5 register 9-7 tic1?ic3 ?timer input capture register 9-7 timer 1 9-1 timer 2 9-15 timer 3 9-24 tmsk1 ?timer interrupt mask register 1 9-12 tmsk2 ?timer interrupt mask reg. 2 4-20 , 9-14 toc1?oc4 ?timer output compare register 9-9 tmsk1 ?timer interrupt mask register 1 9-12 tmsk2 ?timer interrupt mask reg. 2 4-20 , 9-14 to2f - bit in t2flg 9-23 to2i - bit in t2msk 9-23 to3f - bit in t3flg 9-30 to3i - bit in t3msk 9-29 toc1?oc4 ?timer output compare register 9-9 tof - bit in tflg2 9-15 , 9-32 toi - bit in tmsk2 9-14 tpwsl - bit in pwen 9-42 u uart 7-1 v v-bit in ccr 3-5 vdd ad, vss ad pins 2-4 vdd pin 2-4 vectors interrupt 5-12 reset 5-6 , 5-12 vrh, vrl pins 2-6 vss pin 2-4 vstby pin 2-5 w w1a[15:13] - bits in mmwbr 4-30 w1sz[1:0] - bits in mmsiz 4-29 w2a[15:13] - bits in mmwbr 4-30 w2sz[1:0] - bits in mmsiz 4-29 wait mode 5-15 wake - bit in sccr1 7-8 wakeup, sci 7-4 watchdog - see cop wcol - bit in spsr 8-8 wired-or 2-4 , 2-8 , 4-2 , 6-14 woms - bit in sccr1 7-7 x x1a[18:13] - bits in mm1cr 4-31 x2a[18:13] - bits in mm2cr 4-31 x-bit in ccr 3-6 , 5-14 tpg 233
motorola xii MC68HC11KW1 index xdv[1:0] - bits in opt2 4-18 xirq 2-5 , 5-14 xout pin 2-4 xppue - bits in ppar 6-13 xtal pin 2-3 z z-bit in ccr 3-5 tpg 234
2 1 3 4 5 6 7 8 9 10 11 12 13 14 15
2 1 3 4 5 6 7 8 9 10 11 12 13 14 15 how to reach us: mfax : rmfax0@email.sps.mot.com ?touchtone (602) 244-6609 internet : http://design-net.com usa/europe : motorola literature distribution; p.o. box 5405; denver, colorado 80217. 303-675-2140 japan : nippon motorola ltd.; tatsumi-spd-jldc, toshikatsu otsuki, 6f seibu-butsuryu-center, 3-14-2 tatsumi koto-ku, tokyo 135, japan. 03-3521-8315 hong kong : motorola semiconductors h.k. ltd.; 8b tai ping industrial park, 51 ting kok road, tai po, n.t., hong kong. 852-26629298 !motorola


▲Up To Search▲   

 
Price & Availability of MC68HC11KW1

All Rights Reserved © IC-ON-LINE 2003 - 2022  

[Add Bookmark] [Contact Us] [Link exchange] [Privacy policy]
Mirror Sites :  [www.datasheet.hk]   [www.maxim4u.com]  [www.ic-on-line.cn] [www.ic-on-line.com] [www.ic-on-line.net] [www.alldatasheet.com.cn] [www.gdcy.com]  [www.gdcy.net]


 . . . . .
  We use cookies to deliver the best possible web experience and assist with our advertising efforts. By continuing to use this site, you consent to the use of cookies. For more information on cookies, please take a look at our Privacy Policy. X